tom-select
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -32,5 +32,5 @@ import resolve from '@rollup/plugin-node-resolve'; // so Rollup can find `node_modules` | ||
// pass custom options to the resolve plugin | ||
customResolveOptions: { | ||
moduleDirectory: 'node_modules' | ||
} | ||
moduleDirectories: [ | ||
'node_modules', | ||
], | ||
}); | ||
@@ -37,0 +37,0 @@ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -16,3 +16,3 @@ */ | ||
const KEY_TAB = 9; | ||
const IS_MAC = /Mac/.test(navigator.userAgent); | ||
const IS_MAC = typeof navigator === 'undefined' ? false : /Mac/.test(navigator.userAgent); | ||
const KEY_SHORTCUT = IS_MAC ? 'metaKey' : 'ctrlKey'; // ctrl key or apple key for ma | ||
@@ -19,0 +19,0 @@ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -36,3 +36,3 @@ */ | ||
this.rtl = /rtl/i.test(dir); | ||
this.isBlurring = false; | ||
this.tab_key = false; | ||
this.isOpen = false; | ||
@@ -605,2 +605,3 @@ this.isDisabled = false; | ||
if (self.settings.selectOnTab && self.isOpen && self.activeOption) { | ||
self.tab_key = true; | ||
self.onOptionSelect(e, self.activeOption); // prevent default [tab] behaviour of jump to the next field | ||
@@ -610,2 +611,3 @@ // if select isFull, then the dropdown won't be open and [tab] will work normally | ||
preventDefault(e); | ||
self.tab_key = false; | ||
} | ||
@@ -707,11 +709,6 @@ | ||
self.setCaret(self.items.length); | ||
self.refreshState(); // IE11 bug: element still marked as active | ||
dest && dest.focus && dest.focus(); | ||
self.isBlurring = false; | ||
self.refreshState(); | ||
self.trigger('blur'); | ||
}; | ||
self.isBlurring = true; | ||
if (self.settings.create && self.settings.createOnBlur) { | ||
@@ -1998,5 +1995,5 @@ self.createItem(null, false, deactivate); | ||
// this fixes some weird tabbing behavior in FF and IE. | ||
// See #1164 | ||
// See #selectize.js#1164 | ||
if (!self.isBlurring) { | ||
if (!self.tab_key) { | ||
self.blur(); // close keyboard on iOS | ||
@@ -2003,0 +2000,0 @@ } |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -18,3 +18,3 @@ */ | ||
const KEY_RIGHT = 39; | ||
const IS_MAC = /Mac/.test(navigator.userAgent); | ||
const IS_MAC = typeof navigator === 'undefined' ? false : /Mac/.test(navigator.userAgent); | ||
// ctrl key or apple key for ma | ||
@@ -21,0 +21,0 @@ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -17,3 +17,3 @@ */ | ||
const KEY_BACKSPACE = 8; | ||
const IS_MAC = /Mac/.test(navigator.userAgent); | ||
const IS_MAC = typeof navigator === 'undefined' ? false : /Mac/.test(navigator.userAgent); | ||
// ctrl key or apple key for ma | ||
@@ -20,0 +20,0 @@ |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -41,3 +41,3 @@ */ | ||
o.appendChild(a),l.parentNode.replaceChild(o,l),s=1}}else if(1===t.nodeType&&t.childNodes&&!/(script|style)/i.test(t.tagName)&&("highlight"!==t.className||"SPAN"!==t.tagName))for(var p=0;p<t.childNodes.length;++p)p+=e(t.childNodes[p]) | ||
return s}(e)}}const l=/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey" | ||
return s}(e)}}const l="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey" | ||
var a={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,closeAfterSelect:!1,scrollDuration:60,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-control",inputClass:"ts-input",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:null,copyClassesToDropdown:!0,render:{}} | ||
@@ -57,3 +57,3 @@ function p(e){return null==e?null:"boolean"==typeof e?e?"1":"0":e+""}function d(e){return(e+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function c(e,t,i){var s,n=e.trigger,r={} | ||
for(var i=0;e=e.previousElementSibling;)e.matches(t)&&i++ | ||
return i}class S extends(function(e){return e.plugins={},class extends e{static define(t,i){e.plugins[t]={name:t,fn:i}}initializePlugins(e){var t,i,s,n=this,r=[] | ||
return i}class _ extends(function(e){return e.plugins={},class extends e{static define(t,i){e.plugins[t]={name:t,fn:i}}initializePlugins(e){var t,i,s,n=this,r=[] | ||
if(n.plugins={names:[],settings:{},requested:{},loaded:{}},Array.isArray(e))for(t=0,i=e.length;t<i;t++)"string"==typeof e[t]?r.push(e[t]):(n.plugins.settings[e[t].name]=e[t].options,r.push(e[t].name)) | ||
@@ -81,3 +81,3 @@ else if(e)for(s in e)e.hasOwnProperty(s)&&(n.plugins.settings[s]=e[s],r.push(s)) | ||
for(t=0,o=(l=d.split(i.delimiter)).length;t<o;t++)(a={})[n]=l[t],a[r]=l[t],g.options.push(a) | ||
g.items=l}})(),Object.assign({},a,g,t)}(e,t),this.input=e,this.tabIndex=e.getAttribute("tabindex")||null,this.is_select_tag="select"===e.tagName.toLowerCase(),this.rtl=/rtl/i.test(i),this.isBlurring=!1,this.isOpen=!1,this.isDisabled=!1,this.isRequired=e.required,this.isInvalid=!1,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreBlur=!1,this.ignoreHover=!1,this.hasOptions=!1,this.currentResults=null,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],this.renderCache={item:{},option:{}},this.settings.load&&this.settings.loadThrottle&&(this.settings.load=(s=this.settings.load,n=this.settings.loadThrottle,function(e,t){var i=this | ||
g.items=l}})(),Object.assign({},a,g,t)}(e,t),this.input=e,this.tabIndex=e.getAttribute("tabindex")||null,this.is_select_tag="select"===e.tagName.toLowerCase(),this.rtl=/rtl/i.test(i),this.tab_key=!1,this.isOpen=!1,this.isDisabled=!1,this.isRequired=e.required,this.isInvalid=!1,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreBlur=!1,this.ignoreHover=!1,this.hasOptions=!1,this.currentResults=null,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],this.renderCache={item:{},option:{}},this.settings.load&&this.settings.loadThrottle&&(this.settings.load=(s=this.settings.load,n=this.settings.loadThrottle,function(e,t){var i=this | ||
o&&(i.loading=Math.max(i.loading-1,0)),clearTimeout(o),o=setTimeout((function(){o=null,i.loadedSearches[e]=!0,s.call(i,e,t)}),n)})),this.sifter=new r(this.options,{diacritics:this.settings.diacritics}),this.setupOptions(this.settings.options,this.settings.optgroups),delete this.settings.optgroups,delete this.settings.options,this.settings.mode=this.settings.mode||(1===this.settings.maxItems?"single":"multi"),"boolean"!=typeof this.settings.hideSelected&&(this.settings.hideSelected="multi"===this.settings.mode) | ||
@@ -125,3 +125,3 @@ var l=this.settings.createFilter | ||
case 39:return void t.advanceSelection(1,e) | ||
case 9:return t.settings.selectOnTab&&t.isOpen&&t.activeOption&&(t.onOptionSelect(e,t.activeOption),u(e)),void(t.settings.create&&t.createItem()&&u(e)) | ||
case 9:return t.settings.selectOnTab&&t.isOpen&&t.activeOption&&(t.tab_key=!0,t.onOptionSelect(e,t.activeOption),u(e),t.tab_key=!1),void(t.settings.create&&t.createItem()&&u(e)) | ||
case 8:case 46:return void t.deleteSelection(e)}!t.isInputHidden||g(l,e)||u(e)}}onKeyUp(e){var t=this | ||
@@ -134,4 +134,4 @@ if(t.isLocked)u(e) | ||
if(i.isFocused){if(i.isFocused=!1,i.ignoreFocus=!1,!i.ignoreBlur&&document.activeElement===i.dropdown_content)return i.ignoreBlur=!0,void i.onFocus(e) | ||
var s=()=>{i.close(),i.setActiveItem(),i.setActiveOption(),i.setCaret(i.items.length),i.refreshState(),t&&t.focus&&t.focus(),i.isBlurring=!1,i.trigger("blur")} | ||
i.isBlurring=!0,i.settings.create&&i.settings.createOnBlur?i.createItem(null,!1,s):s()}}onOptionHover(e,t){this.ignoreHover||this.setActiveOption(t,!1)}onOptionSelect(e,t){var i,s=this | ||
var s=()=>{i.close(),i.setActiveItem(),i.setActiveOption(),i.setCaret(i.items.length),i.refreshState(),i.trigger("blur")} | ||
i.settings.create&&i.settings.createOnBlur?i.createItem(null,!1,s):s()}}onOptionHover(e,t){this.ignoreHover||this.setActiveOption(t,!1)}onOptionSelect(e,t){var i,s=this | ||
t&&(t.parentElement&&t.parentElement.matches("[data-disabled]")||(t.classList.contains("create")?s.createItem(null,!0,(()=>{s.settings.closeAfterSelect&&s.close()})):void 0!==(i=t.dataset.value)&&(s.lastQuery=null,s.addItem(i),s.settings.closeAfterSelect?s.close():!s.settings.hideSelected&&e.type&&/mouse/.test(e.type)&&s.setActiveOption(s.getOption(i)))))}onItemSelect(e,t){var i=this | ||
@@ -214,3 +214,3 @@ i.isLocked||"multi"===i.settings.mode&&(u(e),i.setActiveItem(t,e))}load(e){var t=this,i=t.settings.load | ||
e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),m(e.dropdown,{visibility:"hidden",display:"block"}),e.positionDropdown(),m(e.dropdown,{visibility:"visible",display:"block"}),e.trigger("dropdown_open",e.dropdown))}close(){var e=this,t=e.isOpen | ||
"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.isBlurring||e.blur()),e.isOpen=!1,m(e.dropdown,{display:"none"}),e.setActiveOption(),e.refreshState(),t&&e.trigger("dropdown_close",e.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var e=this.control,t=e.getBoundingClientRect(),i=e.offsetHeight+t.top+window.scrollY,s=t.left+window.scrollX | ||
"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.tab_key||e.blur()),e.isOpen=!1,m(e.dropdown,{display:"none"}),e.setActiveOption(),e.refreshState(),t&&e.trigger("dropdown_close",e.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var e=this.control,t=e.getBoundingClientRect(),i=e.offsetHeight+t.top+window.scrollY,s=t.left+window.scrollX | ||
m(this.dropdown,{width:t.width+"px",top:i+"px",left:s+"px"})}}clear(e){var t=this | ||
@@ -241,4 +241,4 @@ if(t.items.length){var i=t.controlChildren() | ||
s[t]=function(){var t,r | ||
return"after"===e&&(t=n.apply(s,arguments)),r=i.apply(s,arguments),"instead"===e?r:("before"===e&&(t=n.apply(s,arguments)),t)}}}return S})) | ||
return"after"===e&&(t=n.apply(s,arguments)),r=i.apply(s,arguments),"instead"===e?r:("before"===e&&(t=n.apply(s,arguments)),t)}}}return _})) | ||
var tomSelect=function(e,t){return new TomSelect(e,t)} | ||
//# sourceMappingURL=tom-select.base.min.js.map |
/** | ||
* Tom Select v1.1.1 | ||
* Tom Select v1.1.2 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -41,3 +41,3 @@ */ | ||
o.appendChild(a),l.parentNode.replaceChild(o,l),s=1}}else if(1===t.nodeType&&t.childNodes&&!/(script|style)/i.test(t.tagName)&&("highlight"!==t.className||"SPAN"!==t.tagName))for(var d=0;d<t.childNodes.length;++d)d+=e(t.childNodes[d]) | ||
return s}(e)}}const l=/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey" | ||
return s}(e)}}const l="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey" | ||
var a={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,closeAfterSelect:!1,scrollDuration:60,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-control",inputClass:"ts-input",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:null,copyClassesToDropdown:!0,render:{}} | ||
@@ -65,3 +65,3 @@ function d(e){return null==e?null:"boolean"==typeof e?e?"1":"0":e+""}function p(e){return(e+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function c(e,t,i){var s,n=e.trigger,r={} | ||
return t.innerHTML=e.trim(),t.firstChild}return document.querySelector(e)}function m(e,t){var i=document.createEvent("HTMLEvents") | ||
i.initEvent(t,!0,!1),e.dispatchEvent(i)}function y(e,t){Object.keys(t).forEach((function(i){e.style[i]=t[i]}))}function O(e,...t){var i=b(t);(e=C(e)).map((e=>{i.map((t=>{e.classList.add(t)}))}))}function w(e,...t){var i=b(t);(e=C(e)).map((e=>{i.map((t=>{e.classList.remove(t)}))}))}function b(e){var t=[] | ||
i.initEvent(t,!0,!1),e.dispatchEvent(i)}function y(e,t){Object.keys(t).forEach((function(i){e.style[i]=t[i]}))}function O(e,...t){var i=w(t);(e=C(e)).map((e=>{i.map((t=>{e.classList.add(t)}))}))}function b(e,...t){var i=w(t);(e=C(e)).map((e=>{i.map((t=>{e.classList.remove(t)}))}))}function w(e){var t=[] | ||
for(let i=0;i<e.length;i++){let s=e[i] | ||
@@ -81,3 +81,3 @@ "string"==typeof s&&(s=s.trim().split(/[\11\12\14\15\40]/)),Array.isArray(s)&&(t=t.concat(s))}return t.filter(Boolean)}function C(e){return Array.isArray(e)||(e=[e]),e}function I(e,t,i){if(!i||i.contains(e))for(;e&&e.matches;){if(e.matches(t))return e | ||
if(super(),(e=f(e)).tomselect)throw new Error("Tom Select already initialized on this element") | ||
e.tomselect=this,i=(window.getComputedStyle&&window.getComputedStyle(e,null)).getPropertyValue("direction"),this.order=0,this.settings=v(e,t),this.input=e,this.tabIndex=e.getAttribute("tabindex")||null,this.is_select_tag="select"===e.tagName.toLowerCase(),this.rtl=/rtl/i.test(i),this.isBlurring=!1,this.isOpen=!1,this.isDisabled=!1,this.isRequired=e.required,this.isInvalid=!1,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreBlur=!1,this.ignoreHover=!1,this.hasOptions=!1,this.currentResults=null,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],this.renderCache={item:{},option:{}},this.settings.load&&this.settings.loadThrottle&&(this.settings.load=(s=this.settings.load,n=this.settings.loadThrottle,function(e,t){var i=this | ||
e.tomselect=this,i=(window.getComputedStyle&&window.getComputedStyle(e,null)).getPropertyValue("direction"),this.order=0,this.settings=v(e,t),this.input=e,this.tabIndex=e.getAttribute("tabindex")||null,this.is_select_tag="select"===e.tagName.toLowerCase(),this.rtl=/rtl/i.test(i),this.tab_key=!1,this.isOpen=!1,this.isDisabled=!1,this.isRequired=e.required,this.isInvalid=!1,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreBlur=!1,this.ignoreHover=!1,this.hasOptions=!1,this.currentResults=null,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],this.renderCache={item:{},option:{}},this.settings.load&&this.settings.loadThrottle&&(this.settings.load=(s=this.settings.load,n=this.settings.loadThrottle,function(e,t){var i=this | ||
o&&(i.loading=Math.max(i.loading-1,0)),clearTimeout(o),o=setTimeout((function(){o=null,i.loadedSearches[e]=!0,s.call(i,e,t)}),n)})),this.sifter=new r(this.options,{diacritics:this.settings.diacritics}),this.setupOptions(this.settings.options,this.settings.optgroups),delete this.settings.optgroups,delete this.settings.options,this.settings.mode=this.settings.mode||(1===this.settings.maxItems?"single":"multi"),"boolean"!=typeof this.settings.hideSelected&&(this.settings.hideSelected="multi"===this.settings.mode) | ||
@@ -98,4 +98,4 @@ var l=this.settings.createFilter | ||
var y=e=>{var t=I(e.target,"[data-selectable]",d.dropdown) | ||
t||d.wrapper.contains(e.target)?(u(e,!0),t&&d.onOptionSelect(e,t)):d.isFocused&&d.blur(e.target)},w=()=>{d.isOpen&&d.positionDropdown()},b=()=>{d.ignoreHover=!1} | ||
h(document,"mousedown",y),h(window,"sroll",w,g),h(window,"resize",w,g),h(window,"mousemove",b,g),d._destroy=()=>{document.removeEventListener("mousedown",y),window.removeEventListener("mousemove",b),window.removeEventListener("sroll",w),window.removeEventListener("resize",w)} | ||
t||d.wrapper.contains(e.target)?(u(e,!0),t&&d.onOptionSelect(e,t)):d.isFocused&&d.blur(e.target)},b=()=>{d.isOpen&&d.positionDropdown()},w=()=>{d.ignoreHover=!1} | ||
h(document,"mousedown",y),h(window,"sroll",b,g),h(window,"resize",b,g),h(window,"mousemove",w,g),d._destroy=()=>{document.removeEventListener("mousedown",y),window.removeEventListener("mousemove",w),window.removeEventListener("sroll",b),window.removeEventListener("resize",b)} | ||
for(var C=[];c.children.length>0;)C.push(c.children[0]),c.children[0].remove() | ||
@@ -126,3 +126,3 @@ this.revertSettings={children:C,tabindex:c.getAttribute("tabindex")},c.tabIndex=-1,c.setAttribute("hidden","hidden"),c.insertAdjacentElement("afterend",d.wrapper),d.setValue(p.items),delete p.items,h(c,"invalid",(e=>{u(e),d.isInvalid||(d.isInvalid=!0,d.refreshState())})),d.updateOriginalInput(),d.refreshItems(),d.refreshState(),d.isSetup=!0,c.disabled&&d.disable(),d.on("change",this.onChange),O(c,"tomselected"),d.trigger("initialize"),!0===p.preload&&d.load("")}setupOptions(e,t){var i,s | ||
case 39:return void t.advanceSelection(1,e) | ||
case 9:return t.settings.selectOnTab&&t.isOpen&&t.activeOption&&(t.onOptionSelect(e,t.activeOption),u(e)),void(t.settings.create&&t.createItem()&&u(e)) | ||
case 9:return t.settings.selectOnTab&&t.isOpen&&t.activeOption&&(t.tab_key=!0,t.onOptionSelect(e,t.activeOption),u(e),t.tab_key=!1),void(t.settings.create&&t.createItem()&&u(e)) | ||
case 8:case 46:return void t.deleteSelection(e)}!t.isInputHidden||g(l,e)||u(e)}}onKeyUp(e){var t=this | ||
@@ -135,15 +135,15 @@ if(t.isLocked)u(e) | ||
if(i.isFocused){if(i.isFocused=!1,i.ignoreFocus=!1,!i.ignoreBlur&&document.activeElement===i.dropdown_content)return i.ignoreBlur=!0,void i.onFocus(e) | ||
var s=()=>{i.close(),i.setActiveItem(),i.setActiveOption(),i.setCaret(i.items.length),i.refreshState(),t&&t.focus&&t.focus(),i.isBlurring=!1,i.trigger("blur")} | ||
i.isBlurring=!0,i.settings.create&&i.settings.createOnBlur?i.createItem(null,!1,s):s()}}onOptionHover(e,t){this.ignoreHover||this.setActiveOption(t,!1)}onOptionSelect(e,t){var i,s=this | ||
var s=()=>{i.close(),i.setActiveItem(),i.setActiveOption(),i.setCaret(i.items.length),i.refreshState(),i.trigger("blur")} | ||
i.settings.create&&i.settings.createOnBlur?i.createItem(null,!1,s):s()}}onOptionHover(e,t){this.ignoreHover||this.setActiveOption(t,!1)}onOptionSelect(e,t){var i,s=this | ||
t&&(t.parentElement&&t.parentElement.matches("[data-disabled]")||(t.classList.contains("create")?s.createItem(null,!0,(()=>{s.settings.closeAfterSelect&&s.close()})):void 0!==(i=t.dataset.value)&&(s.lastQuery=null,s.addItem(i),s.settings.closeAfterSelect?s.close():!s.settings.hideSelected&&e.type&&/mouse/.test(e.type)&&s.setActiveOption(s.getOption(i)))))}onItemSelect(e,t){var i=this | ||
i.isLocked||"multi"===i.settings.mode&&(u(e),i.setActiveItem(t,e))}load(e){var t=this,i=t.settings.load | ||
i&&(t.loadedSearches.hasOwnProperty(e)||(O(t.wrapper,t.settings.loadingClass),t.loading++,i.call(t,e,(function(e,i){t.loading=Math.max(t.loading-1,0),t.lastQuery=null,t.setupOptions(e,i),t.refreshOptions(t.isFocused&&!t.isInputHidden),t.loading||w(t.wrapper,t.settings.loadingClass),t.trigger("load",e,i)}))))}onSearchChange(e){this.load(e)}setTextboxValue(e){var t=this.control_input | ||
i&&(t.loadedSearches.hasOwnProperty(e)||(O(t.wrapper,t.settings.loadingClass),t.loading++,i.call(t,e,(function(e,i){t.loading=Math.max(t.loading-1,0),t.lastQuery=null,t.setupOptions(e,i),t.refreshOptions(t.isFocused&&!t.isInputHidden),t.loading||b(t.wrapper,t.settings.loadingClass),t.trigger("load",e,i)}))))}onSearchChange(e){this.load(e)}setTextboxValue(e){var t=this.control_input | ||
t.value!==e&&(t.value=e,m(t,"update"),this.lastValue=e)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(e,t){c(this,t?[]:["change"],(()=>{this.clear(t),this.addItems(e,t)}))}setMaxItems(e){0===e&&(e=null),this.settings.maxItems=e,this.refreshState()}setActiveItem(e,t){var i,s,n,r,o,a,d=this | ||
if("single"!==d.settings.mode){if(!e)return w(d.activeItems,"active"),d.activeItems=[],void(d.isFocused&&d.showInput()) | ||
if("single"!==d.settings.mode){if(!e)return b(d.activeItems,"active"),d.activeItems=[],void(d.isFocused&&d.showInput()) | ||
if("mousedown"===(i=t&&t.type.toLowerCase())&&g("shiftKey",t)&&d.activeItems.length){for(a=d.getLastActive(),(n=Array.prototype.indexOf.call(d.control.children,a))>(r=Array.prototype.indexOf.call(d.control.children,e))&&(o=n,n=r,r=o),s=n;s<=r;s++)e=d.control.children[s],-1===d.activeItems.indexOf(e)&&d.setActiveItemClass(e) | ||
u(t)}else"mousedown"===i&&g(l,t)||"keydown"===i&&g("shiftKey",t)?e.classList.contains("active")?d.removeActiveItem(e):d.setActiveItemClass(e):(w(d.activeItems,"active"),d.activeItems=[],d.setActiveItemClass(e)) | ||
u(t)}else"mousedown"===i&&g(l,t)||"keydown"===i&&g("shiftKey",t)?e.classList.contains("active")?d.removeActiveItem(e):d.setActiveItemClass(e):(b(d.activeItems,"active"),d.activeItems=[],d.setActiveItemClass(e)) | ||
d.hideInput(),d.isFocused||d.focus()}}setActiveItemClass(e){var t=this.control.querySelector(".last-active") | ||
t&&w(t,"last-active"),O(e,"active last-active"),-1==this.activeItems.indexOf(e)&&this.activeItems.push(e)}removeActiveItem(e){var t=this.activeItems.indexOf(e) | ||
this.activeItems.splice(t,1),w(e,"active")}setActiveOption(e,t){var i,s,n | ||
if(e!==this.activeOption&&(this.activeOption&&w(this.activeOption,"active"),this.activeOption=null,e&&(this.activeOption=e,O(e,"active"),t))){i=this.dropdown_content.clientHeight | ||
t&&b(t,"last-active"),O(e,"active last-active"),-1==this.activeItems.indexOf(e)&&this.activeItems.push(e)}removeActiveItem(e){var t=this.activeItems.indexOf(e) | ||
this.activeItems.splice(t,1),b(e,"active")}setActiveOption(e,t){var i,s,n | ||
if(e!==this.activeOption&&(this.activeOption&&b(this.activeOption,"active"),this.activeOption=null,e&&(this.activeOption=e,O(e,"active"),t))){i=this.dropdown_content.clientHeight | ||
let e=this.dropdown_content.scrollTop||0 | ||
@@ -155,5 +155,5 @@ s=this.activeOption.offsetHeight,(n=this.activeOption.getBoundingClientRect().top-this.dropdown_content.getBoundingClientRect().top+e)+s>i+e?this.dropdown_content.scrollTop=n-i+s:n<e&&(this.dropdown_content.scrollTop=n)}}selectAll(){"single"!==this.settings.mode&&(this.activeItems=this.controlChildren(),this.activeItems.length&&(O(this.activeItems,"active"),this.hideInput(),this.close()),this.focus())}hideInput(){this.settings.controlInput||(this.setTextboxValue(""),y(this.control_input,{opacity:0,position:"absolute",left:(this.rtl?1e4:-1e4)+"px"}),this.isInputHidden=!0)}showInput(){this.settings.controlInput||(y(this.control_input,{opacity:1,position:"relative",left:0}),this.isInputHidden=!1)}inputValue(){return this.control_input.value.trim()}focus(){var e=this | ||
if(e!==n.lastQuery?(n.lastQuery=e,i=n.sifter.search(e,Object.assign(o,{score:s})),n.currentResults=i):i=Object.assign({},n.currentResults),r.hideSelected)for(t=i.items.length-1;t>=0;t--)-1!==n.items.indexOf(d(i.items[t].id))&&i.items.splice(t,1) | ||
return i}refreshOptions(e=!0){var t,i,s,n,r,l,a,p,c,u,h,g,v,f=this,m=f.inputValue(),y=f.search(m),b=f.activeOption&&d(f.activeOption.dataset.value),C=!1 | ||
return i}refreshOptions(e=!0){var t,i,s,n,r,l,a,p,c,u,h,g,v,f=this,m=f.inputValue(),y=f.search(m),w=f.activeOption&&d(f.activeOption.dataset.value),C=!1 | ||
for(n=y.items.length,"number"==typeof f.settings.maxOptions&&(n=Math.min(n,f.settings.maxOptions)),n>0&&(C=!0),r={},l=[],t=0;t<n;t++){let e=f.options[y.items[t].id],n=d(e[f.settings.valueField]),o=f.getOption(n) | ||
for(o||(o=f.render("option",e)),a=e[f.settings.optgroupField]||"",i=0,s=(p=Array.isArray(a)?a:[a])&&p.length;i<s;i++)a=p[i],f.optgroups.hasOwnProperty(a)||(a=""),r.hasOwnProperty(a)||(r[a]=document.createDocumentFragment(),l.push(a)),i>0&&(o=o.cloneNode(!0),w(o,"active")),r[a].appendChild(o)}for(this.settings.lockOptgroupOrder&&l.sort(((e,t)=>(f.optgroups[e].$order||0)-(f.optgroups[t].$order||0))),c=document.createDocumentFragment(),t=0,n=l.length;t<n;t++)if(a=l[t],f.optgroups.hasOwnProperty(a)&&r[a].children.length){let e=document.createDocumentFragment() | ||
for(o||(o=f.render("option",e)),a=e[f.settings.optgroupField]||"",i=0,s=(p=Array.isArray(a)?a:[a])&&p.length;i<s;i++)a=p[i],f.optgroups.hasOwnProperty(a)||(a=""),r.hasOwnProperty(a)||(r[a]=document.createDocumentFragment(),l.push(a)),i>0&&(o=o.cloneNode(!0),b(o,"active")),r[a].appendChild(o)}for(this.settings.lockOptgroupOrder&&l.sort(((e,t)=>(f.optgroups[e].$order||0)-(f.optgroups[t].$order||0))),c=document.createDocumentFragment(),t=0,n=l.length;t<n;t++)if(a=l[t],f.optgroups.hasOwnProperty(a)&&r[a].children.length){let e=document.createDocumentFragment() | ||
e.appendChild(f.render("optgroup_header",f.optgroups[a])),e.appendChild(r[a]) | ||
@@ -167,3 +167,3 @@ let t=f.render("optgroup",{group:f.optgroups[a],options:e}) | ||
return t&&(C=!0,f.dropdown_content.insertBefore(t,f.dropdown_content.firstChild)),t} | ||
if(f.loading?I("loading"):0===y.items.length&&f.settings.render.no_results&&m.length&&I("no_results"),(u=f.canCreate(m))&&(g=I("option_create")),f.hasOptions=y.items.length>0||u,C){if(y.items.length>0){if(!(h=b&&f.getOption(b))||!f.dropdown_content.contains(h)){let e=0 | ||
if(f.loading?I("loading"):0===y.items.length&&f.settings.render.no_results&&m.length&&I("no_results"),(u=f.canCreate(m))&&(g=I("option_create")),f.hasOptions=y.items.length>0||u,C){if(y.items.length>0){if(!(h=w&&f.getOption(w))||!f.dropdown_content.contains(h)){let e=0 | ||
g&&!f.settings.addPrecedence&&(e=1),h=f.selectable()[e]}}else h=g | ||
@@ -197,3 +197,3 @@ f.setActiveOption(h),e&&!f.isOpen&&f.open()}else f.setActiveOption(),e&&f.isOpen&&f.close()}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(e){var t,i,s,n=this | ||
n.refreshOptions(n.isFocused&&"single"!==r),i&&n.setActiveOption(i)}!s.length||n.isFull()?n.close():n.isPending||n.positionDropdown(),n.trigger("item_add",e,i),n.isPending||n.updateOriginalInput({silent:t})}}))}removeItem(e,t){var i,s,n=this,r=n.getItem(e) | ||
r&&(e=d(r.dataset.value),-1!==(i=n.items.indexOf(e))&&(r.remove(),r.classList.contains("active")&&(s=n.activeItems.indexOf(r),n.activeItems.splice(s,1),w(r,"active")),n.items.splice(i,1),n.lastQuery=null,!n.settings.persist&&n.userOptions.hasOwnProperty(e)&&n.removeOption(e,t),i<n.caretPos&&n.setCaret(n.caretPos-1),n.refreshState(),n.updateOriginalInput({silent:t}),n.positionDropdown(),n.trigger("item_remove",e,r)))}createItem(e,t=!0,i){var s,n=this,r=n.caretPos | ||
r&&(e=d(r.dataset.value),-1!==(i=n.items.indexOf(e))&&(r.remove(),r.classList.contains("active")&&(s=n.activeItems.indexOf(r),n.activeItems.splice(s,1),b(r,"active")),n.items.splice(i,1),n.lastQuery=null,!n.settings.persist&&n.userOptions.hasOwnProperty(e)&&n.removeOption(e,t),i<n.caretPos&&n.setCaret(n.caretPos-1),n.refreshState(),n.updateOriginalInput({silent:t}),n.positionDropdown(),n.trigger("item_remove",e,r)))}createItem(e,t=!0,i){var s,n=this,r=n.caretPos | ||
if(e=e||n.inputValue(),"function"!=typeof i&&(i=()=>{}),!n.canCreate(e))return i(),!1 | ||
@@ -218,3 +218,3 @@ n.lock() | ||
e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),y(e.dropdown,{visibility:"hidden",display:"block"}),e.positionDropdown(),y(e.dropdown,{visibility:"visible",display:"block"}),e.trigger("dropdown_open",e.dropdown))}close(){var e=this,t=e.isOpen | ||
"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.isBlurring||e.blur()),e.isOpen=!1,y(e.dropdown,{display:"none"}),e.setActiveOption(),e.refreshState(),t&&e.trigger("dropdown_close",e.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var e=this.control,t=e.getBoundingClientRect(),i=e.offsetHeight+t.top+window.scrollY,s=t.left+window.scrollX | ||
"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.tab_key||e.blur()),e.isOpen=!1,y(e.dropdown,{display:"none"}),e.setActiveOption(),e.refreshState(),t&&e.trigger("dropdown_close",e.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var e=this.control,t=e.getBoundingClientRect(),i=e.offsetHeight+t.top+window.scrollY,s=t.left+window.scrollX | ||
y(this.dropdown,{width:t.width+"px",top:i+"px",left:s+"px"})}}clear(e){var t=this | ||
@@ -240,3 +240,3 @@ if(t.items.length){var i=t.controlChildren() | ||
e.input.disabled=!1,e.control_input.disabled=!1,e.control_input.tabIndex=e.tabIndex,e.isDisabled=!1,e.unlock()}destroy(){var e=this,t=e.revertSettings | ||
e.trigger("destroy"),e.off(),e.wrapper.remove(),e.dropdown.remove(),e.input.innerHTML="",t.tabindex?e.input.setAttribute("tabindex",t.tabindex):e.input.removeAttribute("tabindex"),w(e.input,"tomselected"),e.input.removeAttribute("hidden"),e.input.required=this.isRequired | ||
e.trigger("destroy"),e.off(),e.wrapper.remove(),e.dropdown.remove(),e.input.innerHTML="",t.tabindex?e.input.setAttribute("tabindex",t.tabindex):e.input.removeAttribute("tabindex"),b(e.input,"tomselected"),e.input.removeAttribute("hidden"),e.input.required=this.isRequired | ||
for(let i=0;i<t.children.length;i++)e.input.appendChild(t.children[i]) | ||
@@ -243,0 +243,0 @@ e._destroy(),delete e.input.tomselect}render(e,t){var i,s,n,r=this |
@@ -34,3 +34,3 @@ import Sifter from './contrib/sifter.js'; | ||
sifter: Sifter; | ||
isBlurring: boolean; | ||
tab_key: boolean; | ||
isOpen: boolean; | ||
@@ -37,0 +37,0 @@ isDisabled: boolean; |
@@ -11,4 +11,4 @@ var fs = require('fs'); | ||
grunt.loadNpmTasks('grunt-replace'); | ||
grunt.loadNpmTasks('@lodder/grunt-postcss'); | ||
const sass = require('node-sass'); | ||
@@ -15,0 +15,0 @@ |
@@ -19,3 +19,3 @@ { | ||
"homepage": "https://tom-select.js.org", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"author": "Josh Schmidt (https://github.com/oyejorge)", | ||
@@ -37,5 +37,6 @@ "contributors": [ | ||
"@babel/preset-typescript": "^7.12.1", | ||
"@lodder/grunt-postcss": "^3.0.0", | ||
"@rollup/plugin-babel": "^5.2.1", | ||
"@rollup/plugin-commonjs": "^15.1.0", | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"@rollup/plugin-commonjs": "^17.1.0", | ||
"@rollup/plugin-node-resolve": "^11.1.1", | ||
"@types/jquery": "^3.5.4", | ||
@@ -56,3 +57,2 @@ "@types/jqueryui": "^1.12.13", | ||
"grunt-contrib-watch": "1.x", | ||
"grunt-postcss": "^0.9.0", | ||
"grunt-replace": "^1.0.1", | ||
@@ -62,3 +62,3 @@ "grunt-sass": "^3.1.0", | ||
"jquery": "^3.5.1", | ||
"karma": "^5.1.1", | ||
"karma": "^6.1.0", | ||
"karma-browserstack-launcher": "^1.6.0", | ||
@@ -69,3 +69,3 @@ "karma-chai": "^0.1.0", | ||
"karma-coveralls": "^2.1.0", | ||
"karma-firefox-launcher": "^1.3.0", | ||
"karma-firefox-launcher": "^2.1.0", | ||
"karma-mocha": "^2.0.1", | ||
@@ -76,5 +76,5 @@ "karma-mocha-reporter": "^2.2.0", | ||
"load-grunt-tasks": "^5.1.0", | ||
"markdown-it-anchor": "^5.3.0", | ||
"markdown-it-anchor": "^7.0.1", | ||
"mocha": "^8.1.1", | ||
"node-sass": "^4.14.1", | ||
"node-sass": "^5.0.0", | ||
"rollup": "^2.32.1", | ||
@@ -81,0 +81,0 @@ "rollup-plugin-insert": "^1.3.1", |
@@ -12,3 +12,3 @@ export const KEY_A = 65; | ||
export const IS_MAC = /Mac/.test(navigator.userAgent); | ||
export const IS_MAC = typeof navigator === 'undefined' ? false : /Mac/.test(navigator.userAgent); | ||
export const KEY_SHORTCUT = IS_MAC ? 'metaKey' : 'ctrlKey'; // ctrl key or apple key for ma |
@@ -53,3 +53,3 @@ | ||
public isBlurring : boolean; | ||
public tab_key : boolean; | ||
public isOpen : boolean; | ||
@@ -111,3 +111,3 @@ public isDisabled : boolean; | ||
this.isBlurring = false; | ||
this.tab_key = false; | ||
this.isOpen = false; | ||
@@ -696,2 +696,3 @@ this.isDisabled = false; | ||
if (self.settings.selectOnTab && self.isOpen && self.activeOption) { | ||
self.tab_key = true; | ||
self.onOptionSelect(e,self.activeOption); | ||
@@ -702,2 +703,3 @@ | ||
preventDefault(e); | ||
self.tab_key = false; | ||
} | ||
@@ -797,11 +799,5 @@ if (self.settings.create && self.createItem()) { | ||
self.refreshState(); | ||
// IE11 bug: element still marked as active | ||
dest && dest.focus && dest.focus(); | ||
self.isBlurring = false; | ||
self.trigger('blur'); | ||
}; | ||
self.isBlurring = true; | ||
if (self.settings.create && self.settings.createOnBlur) { | ||
@@ -2045,4 +2041,4 @@ self.createItem(null, false, deactivate); | ||
// this fixes some weird tabbing behavior in FF and IE. | ||
// See #1164 | ||
if (!self.isBlurring) { | ||
// See #selectize.js#1164 | ||
if( !self.tab_key ){ | ||
self.blur(); // close keyboard on iOS | ||
@@ -2049,0 +2045,0 @@ } |
@@ -469,4 +469,24 @@ | ||
it_n('should select option with [enter] keypress', function(done) { | ||
it_n('should select option with [enter] keypress (single)', function(done) { | ||
var test = setup_test('AB_Single'); | ||
click(test.instance.control, function() { | ||
expect(test.instance.activeOption.dataset.value).to.be.equal('a'); | ||
syn.type('a', test.instance.control_input, function() { | ||
syn.type('[enter]', test.instance.control_input, function() { | ||
assert.equal( test.instance.items.length, 1); | ||
assert.equal( test.instance.items[0], 'a'); | ||
assert.equal( test.instance.control_input.value, '', 'control_input.value != ""' ); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
// differs from above "single" test with the value of the control_input after selection | ||
it_n('should select option with [enter] keypress (multiple)', function(done) { | ||
var test = setup_test('AB_Multi'); | ||
@@ -477,11 +497,11 @@ | ||
syn.type('[enter]', test.instance.control_input, function() { | ||
expect(test.instance.items.length).to.be.equal(1); | ||
expect(test.instance.items[0]).to.be.equal('a'); | ||
done(); | ||
syn.type('a', test.instance.control_input, function() { | ||
syn.type('[enter]', test.instance.control_input, function() { | ||
assert.equal( test.instance.items.length, 1); | ||
assert.equal( test.instance.items[0], 'a'); | ||
assert.equal( test.instance.control_input.value, 'a', 'control_input.value != "a"' ); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -491,3 +511,3 @@ | ||
var test = setup_test('AB_Multi',{selectOnTab:true}); | ||
var test = setup_test('AB_Single',{selectOnTab:true}); | ||
@@ -498,4 +518,5 @@ click(test.instance.control, function() { | ||
syn.type('[tab]', test.instance.control_input, function() { | ||
expect(test.instance.items.length).to.be.equal(1); | ||
expect(test.instance.items[0]).to.be.equal('a'); | ||
assert.equal( test.instance.items.length, 1, 'item.length != 1' ); | ||
assert.equal( test.instance.items[0], 'a', 'item[0] != a' ); | ||
assert.equal( test.instance.isFocused, true, 'isFocused != true' ); | ||
done(); | ||
@@ -516,2 +537,3 @@ | ||
syn.type('[tab]', test.instance.control_input, function() { | ||
expect(test.instance.isFocused).to.be.equal(true); | ||
expect(test.instance.items.length).to.be.equal(0); | ||
@@ -518,0 +540,0 @@ done(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
200
34785
2699995