Skip to content

Commit

Permalink
Get tests passing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Humphreys committed Mar 6, 2020
1 parent 7f1c356 commit 4d68b21
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 6 deletions.
15 changes: 14 additions & 1 deletion dist/tribute.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,10 @@ class Tribute {

// function called when menu is empty, disables hiding of menu.
noMatchTemplate: (t => {
if (typeof t === "string") {
if (t.trim() === "") return null;
return t;
}
if (typeof t === "function") {
return t.bind(this);
}
Expand Down Expand Up @@ -1405,11 +1409,20 @@ class Tribute {
).bind(this),
// function called when menu is empty, disables hiding of menu.
noMatchTemplate: (t => {
if (typeof t === "string") {
if (t.trim() === "") return null;
return t;
}
if (typeof t === "function") {
return t.bind(this);
}

return null;
return (
noMatchTemplate ||
function() {
return "<li>No Match Found!</li>";
}.bind(this)
);
})(noMatchTemplate),
lookup: item.lookup || lookup,
fillAttr: item.fillAttr || fillAttr,
Expand Down
16 changes: 15 additions & 1 deletion dist/tribute.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

(function(l, r) { if (l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (window.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.head.appendChild(r) })(window.document);
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
Expand Down Expand Up @@ -1400,6 +1402,11 @@
menuItemTemplate: (menuItemTemplate || Tribute.defaultMenuItemTemplate).bind(this),
// function called when menu is empty, disables hiding of menu.
noMatchTemplate: function (t) {
if (typeof t === "string") {
if (t.trim() === "") return null;
return t;
}

if (typeof t === "function") {
return t.bind(_this);
}
Expand Down Expand Up @@ -1432,11 +1439,18 @@
menuItemTemplate: (item.menuItemTemplate || Tribute.defaultMenuItemTemplate).bind(_this),
// function called when menu is empty, disables hiding of menu.
noMatchTemplate: function (t) {
if (typeof t === "string") {
if (t.trim() === "") return null;
return t;
}

if (typeof t === "function") {
return t.bind(_this);
}

return null;
return noMatchTemplate || function () {
return "<li>No Match Found!</li>";
}.bind(_this);
}(noMatchTemplate),
lookup: item.lookup || lookup,
fillAttr: item.fillAttr || fillAttr,
Expand Down
2 changes: 1 addition & 1 deletion dist/tribute.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/tribute.min.js.map

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion example/tribute.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

(function(l, r) { if (l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (window.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.head.appendChild(r) })(window.document);
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
Expand Down Expand Up @@ -1400,6 +1402,11 @@
menuItemTemplate: (menuItemTemplate || Tribute.defaultMenuItemTemplate).bind(this),
// function called when menu is empty, disables hiding of menu.
noMatchTemplate: function (t) {
if (typeof t === "string") {
if (t.trim() === "") return null;
return t;
}

if (typeof t === "function") {
return t.bind(_this);
}
Expand Down Expand Up @@ -1432,11 +1439,18 @@
menuItemTemplate: (item.menuItemTemplate || Tribute.defaultMenuItemTemplate).bind(_this),
// function called when menu is empty, disables hiding of menu.
noMatchTemplate: function (t) {
if (typeof t === "string") {
if (t.trim() === "") return null;
return t;
}

if (typeof t === "function") {
return t.bind(_this);
}

return null;
return noMatchTemplate || function () {
return "<li>No Match Found!</li>";
}.bind(_this);
}(noMatchTemplate),
lookup: item.lookup || lookup,
fillAttr: item.fillAttr || fillAttr,
Expand Down
15 changes: 14 additions & 1 deletion src/Tribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ class Tribute {

// function called when menu is empty, disables hiding of menu.
noMatchTemplate: (t => {
if (typeof t === "string") {
if (t.trim() === "") return null;
return t;
}
if (typeof t === "function") {
return t.bind(this);
}
Expand Down Expand Up @@ -126,11 +130,20 @@ class Tribute {
).bind(this),
// function called when menu is empty, disables hiding of menu.
noMatchTemplate: (t => {
if (typeof t === "string") {
if (t.trim() === "") return null;
return t;
}
if (typeof t === "function") {
return t.bind(this);
}

return null;
return (
noMatchTemplate ||
function() {
return "<li>No Match Found!</li>";
}.bind(this)
);
})(noMatchTemplate),
lookup: item.lookup || lookup,
fillAttr: item.fillAttr || fillAttr,
Expand Down

0 comments on commit 4d68b21

Please sign in to comment.