Merge lp:~jonas-drange/online-services-common-js/searchbar-as-module into lp:online-services-common-js
- searchbar-as-module
- Merge into trunk
Proposed by
Jonas G. Drange
Status: | Merged |
---|---|
Approved by: | Jonas G. Drange |
Approved revision: | 36 |
Merged at revision: | 33 |
Proposed branch: | lp:~jonas-drange/online-services-common-js/searchbar-as-module |
Merge into: | lp:online-services-common-js |
Diff against target: |
1402 lines (+407/-793) 24 files modified
build/config.js (+1/-1) build/navbar-autocomplete/navbar-autocomplete-coverage.js (+0/-6) build/navbar-autocomplete/navbar-autocomplete-debug.js (+0/-109) build/navbar-autocomplete/navbar-autocomplete-min.js (+0/-1) build/navbar-autocomplete/navbar-autocomplete.js (+0/-106) build/navbar/navbar-coverage.js (+2/-2) build/navbar/navbar-debug.js (+19/-38) build/navbar/navbar-min.js (+1/-1) build/navbar/navbar.js (+19/-38) build/searchbar-autocomplete/searchbar-autocomplete-coverage.js (+6/-0) build/searchbar-autocomplete/searchbar-autocomplete-debug.js (+43/-0) build/searchbar-autocomplete/searchbar-autocomplete-min.js (+1/-0) build/searchbar-autocomplete/searchbar-autocomplete.js (+43/-0) config-manager.txt (+1/-1) src/navbar/build.json (+1/-19) src/navbar/js/navbar-autocomplete.js (+0/-103) src/navbar/js/navbar.js (+18/-37) src/navbar/tests/manual/index.html (+2/-58) src/navbar/tests/unit/js/tests.js (+2/-273) src/searchbar/build.json (+20/-0) src/searchbar/js/searchbar-autocomplete.js (+37/-0) src/searchbar/tests/manual/index.html (+33/-0) src/searchbar/tests/unit/index.html (+54/-0) src/searchbar/tests/unit/js/tests.js (+104/-0) |
To merge this branch: | bzr merge lp:~jonas-drange/online-services-common-js/searchbar-as-module |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stephen Stewart (community) | Approve | ||
Review via email: mp+219339@code.launchpad.net |
Commit message
- new module 'searchbar', which now builds only one module, 'searchbar-
- removing all search code in navbar
- bumping ulysses dep to 42
Description of the change
To post a comment you must log in.
Revision history for this message
Stephen Stewart (stephen-stewart) wrote : | # |
- 36. By Jonas G. Drange
-
addressing comments
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'build/config.js' |
2 | --- build/config.js 2014-05-01 15:38:15 +0000 |
3 | +++ build/config.js 2014-05-14 09:49:37 +0000 |
4 | @@ -1,1 +1,1 @@ |
5 | -YUI.GlobalConfig = {"groups":{"os":{"modules":{"carousel":{"skinnable":true,"requires":["base","node","anim","event"]},"ga-tracking":{"requires":["node"]},"global-navigation-templates":{"requires":["template"]},"global-navigation":{"requires":["node","template","array-extras","global-navigation-templates"],"skinnable":true},"html5-details":{"requires":["base","node","event"]},"myapps-hud":{"skinnable":true,"requires":["node"]},"navbar":{"requires":["node","plugin-collapse"]},"navbar-autocomplete":{"requires":["node","autocomplete","autocomplete-highlighters"],"after":["navbar"]},"overlay-extras":{"requires":["overlay","plugin","event-resize","event-outside"]},"password-meter":{"requires":["base","widget","event-key","transition"],"skinnable":true},"plugin-collapse":{"requires":["base","plugin","node-pluginhost","transition"]},"plugin-jit-bar":{"requires":["anim","node","node-scroll-info","plugin"],"skinnable":true},"rangyinputs":{},"uploader-augmented":{"requires":["array-extras","uploader-html5"]},"uploader-follow":{"requires":["base","anim"]},"uploader-myapps-packages-for-extraction":{"requires":["base","uploader-myapps-packages","util","cookie","io","json-parse"]},"uploader-myapps-packages":{"requires":["base","uploader-myapps","util","cookie","io","json-parse"]},"uploader-myapps-templates":{"requires":["template"]},"uploader-myapps":{"skinnable":true,"requires":["template","uploader-augmented","uploader-myapps-templates","node"]},"util-share":{"requires":["base","node"]},"util-stacktrace":{"requires":[]},"util-oops":{"requires":["base","io-base","json-stringify"]},"util-myapps":{"skinnable":true,"requires":["base","node"]},"util":{"use":["util-share","util-stacktrace","util-oops","util-myapps"]},"widget-cc-input":{"requires":["node-pluginhost","widget","base","transition","button","rangyinputs","template"],"skinnable":true},"position-sticky":{"requires":["widget","substitute","node","event-resize"]},"widget-tooltip":{"requires":["event-mouseenter","widget","widget-position","widget-position-align","widget-stack","escape"],"skinnable":true}}}}}; |
6 | \ No newline at end of file |
7 | +YUI.GlobalConfig = {"groups":{"os":{"modules":{"carousel":{"skinnable":true,"requires":["base","node","anim","event"]},"ga-tracking":{"requires":["node"]},"global-navigation-templates":{"requires":["template"]},"global-navigation":{"requires":["node","template","array-extras","global-navigation-templates"],"skinnable":true},"html5-details":{"requires":["base","node","event"]},"myapps-hud":{"skinnable":true,"requires":["node"]},"navbar":{"requires":["node","plugin-collapse"]},"overlay-extras":{"requires":["overlay","plugin","event-resize","event-outside"]},"password-meter":{"requires":["base","widget","event-key","transition"],"skinnable":true},"plugin-collapse":{"requires":["base","plugin","node-pluginhost","transition"]},"plugin-jit-bar":{"requires":["anim","node","node-scroll-info","plugin"],"skinnable":true},"rangyinputs":{},"searchbar-autocomplete":{"requires":["node","autocomplete"]},"uploader-augmented":{"requires":["array-extras","uploader-html5"]},"uploader-follow":{"requires":["base","anim"]},"uploader-myapps-packages-for-extraction":{"requires":["base","uploader-myapps-packages","util","cookie","io","json-parse"]},"uploader-myapps-packages":{"requires":["base","uploader-myapps","util","cookie","io","json-parse"]},"uploader-myapps-templates":{"requires":["template"]},"uploader-myapps":{"skinnable":true,"requires":["template","uploader-augmented","uploader-myapps-templates","node"]},"util-share":{"requires":["base","node"]},"util-stacktrace":{"requires":[]},"util-oops":{"requires":["base","io-base","json-stringify"]},"util-myapps":{"skinnable":true,"requires":["base","node"]},"util":{"use":["util-share","util-stacktrace","util-oops","util-myapps"]},"widget-cc-input":{"requires":["node-pluginhost","widget","base","transition","button","rangyinputs","template"],"skinnable":true},"position-sticky":{"requires":["widget","substitute","node","event-resize"]},"widget-tooltip":{"requires":["event-mouseenter","widget","widget-position","widget-position-align","widget-stack","escape"],"skinnable":true}}}}}; |
8 | \ No newline at end of file |
9 | |
10 | === removed directory 'build/navbar-autocomplete' |
11 | === removed file 'build/navbar-autocomplete/navbar-autocomplete-coverage.js' |
12 | --- build/navbar-autocomplete/navbar-autocomplete-coverage.js 2014-04-22 10:29:38 +0000 |
13 | +++ build/navbar-autocomplete/navbar-autocomplete-coverage.js 1970-01-01 00:00:00 +0000 |
14 | @@ -1,6 +0,0 @@ |
15 | -if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } |
16 | -if (!__coverage__['build/navbar-autocomplete/navbar-autocomplete.js']) { |
17 | - __coverage__['build/navbar-autocomplete/navbar-autocomplete.js'] = {"path":"build/navbar-autocomplete/navbar-autocomplete.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":50}}},"2":{"name":"(anonymous_2)","line":4,"loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":12}}},"3":{"name":"afterAutoCompleteEvents","line":12,"loc":{"start":{"line":12,"column":0},"end":{"line":12,"column":43}}},"4":{"name":"(anonymous_4)","line":53,"loc":{"start":{"line":53,"column":17},"end":{"line":53,"column":35}}},"5":{"name":"(anonymous_5)","line":86,"loc":{"start":{"line":86,"column":38},"end":{"line":86,"column":51}}},"6":{"name":"(anonymous_6)","line":96,"loc":{"start":{"line":96,"column":41},"end":{"line":96,"column":54}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":106,"column":81}},"2":{"start":{"line":4,"column":0},"end":{"line":103,"column":5}},"3":{"start":{"line":7,"column":0},"end":{"line":7,"column":23}},"4":{"start":{"line":12,"column":0},"end":{"line":48,"column":1}},"5":{"start":{"line":15,"column":4},"end":{"line":15,"column":25}},"6":{"start":{"line":17,"column":4},"end":{"line":17,"column":21}},"7":{"start":{"line":19,"column":4},"end":{"line":19,"column":33}},"8":{"start":{"line":21,"column":4},"end":{"line":21,"column":27}},"9":{"start":{"line":24,"column":4},"end":{"line":26,"column":5}},"10":{"start":{"line":25,"column":8},"end":{"line":25,"column":15}},"11":{"start":{"line":29,"column":4},"end":{"line":31,"column":5}},"12":{"start":{"line":30,"column":8},"end":{"line":30,"column":61}},"13":{"start":{"line":34,"column":4},"end":{"line":38,"column":5}},"14":{"start":{"line":35,"column":8},"end":{"line":35,"column":25}},"15":{"start":{"line":37,"column":8},"end":{"line":37,"column":68}},"16":{"start":{"line":41,"column":4},"end":{"line":41,"column":65}},"17":{"start":{"line":43,"column":4},"end":{"line":43,"column":71}},"18":{"start":{"line":46,"column":4},"end":{"line":46,"column":54}},"19":{"start":{"line":50,"column":0},"end":{"line":50,"column":35}},"20":{"start":{"line":52,"column":0},"end":{"line":101,"column":1}},"21":{"start":{"line":53,"column":4},"end":{"line":100,"column":7}},"22":{"start":{"line":56,"column":8},"end":{"line":56,"column":48}},"23":{"start":{"line":58,"column":8},"end":{"line":58,"column":18}},"24":{"start":{"line":60,"column":8},"end":{"line":60,"column":28}},"25":{"start":{"line":62,"column":8},"end":{"line":64,"column":9}},"26":{"start":{"line":63,"column":12},"end":{"line":63,"column":19}},"27":{"start":{"line":66,"column":8},"end":{"line":66,"column":52}},"28":{"start":{"line":67,"column":8},"end":{"line":69,"column":9}},"29":{"start":{"line":68,"column":12},"end":{"line":68,"column":61}},"30":{"start":{"line":72,"column":8},"end":{"line":76,"column":11}},"31":{"start":{"line":80,"column":8},"end":{"line":83,"column":11}},"32":{"start":{"line":86,"column":8},"end":{"line":88,"column":11}},"33":{"start":{"line":87,"column":12},"end":{"line":87,"column":74}},"34":{"start":{"line":91,"column":8},"end":{"line":91,"column":54}},"35":{"start":{"line":92,"column":8},"end":{"line":92,"column":78}},"36":{"start":{"line":93,"column":8},"end":{"line":93,"column":64}},"37":{"start":{"line":96,"column":8},"end":{"line":98,"column":11}},"38":{"start":{"line":97,"column":12},"end":{"line":97,"column":58}}},"branchMap":{"1":{"line":24,"type":"if","locations":[{"start":{"line":24,"column":4},"end":{"line":24,"column":4}},{"start":{"line":24,"column":4},"end":{"line":24,"column":4}}]},"2":{"line":29,"type":"if","locations":[{"start":{"line":29,"column":4},"end":{"line":29,"column":4}},{"start":{"line":29,"column":4},"end":{"line":29,"column":4}}]},"3":{"line":34,"type":"if","locations":[{"start":{"line":34,"column":4},"end":{"line":34,"column":4}},{"start":{"line":34,"column":4},"end":{"line":34,"column":4}}]},"4":{"line":34,"type":"binary-expr","locations":[{"start":{"line":34,"column":7},"end":{"line":34,"column":56}},{"start":{"line":34,"column":60},"end":{"line":34,"column":69}}]},"5":{"line":52,"type":"if","locations":[{"start":{"line":52,"column":0},"end":{"line":52,"column":0}},{"start":{"line":52,"column":0},"end":{"line":52,"column":0}}]},"6":{"line":62,"type":"if","locations":[{"start":{"line":62,"column":8},"end":{"line":62,"column":8}},{"start":{"line":62,"column":8},"end":{"line":62,"column":8}}]},"7":{"line":67,"type":"if","locations":[{"start":{"line":67,"column":8},"end":{"line":67,"column":8}},{"start":{"line":67,"column":8},"end":{"line":67,"column":8}}]}},"code":["(function () { YUI.add('navbar-autocomplete', function (Y, NAME) {","","\"use strict\";","(function() {","","// store height of collapse once opened","var baseCollapseHeight;","","// whever something happens with re: to the autocomplete,","// we need to change the height of the collapse to match the","// length of the list","function afterAutoCompleteEvents (e, args) {",""," // transition config of collapse"," var transitionConfig;"," // height of autocomplete list node"," var acListHeight;"," // collapse itself"," var collapse = args.collapse;"," // input which has autocomplete plugin"," var input = args.input;",""," // only calculate new height if autocomplete collapse is expanded"," if(!collapse.get('state')) {"," return;"," }",""," // would only happen if collapse did not open properly"," if(!baseCollapseHeight) {"," throw new Error('baseCollapseHeight was falsy or 0');"," }",""," // list was made invisible"," if(e.type === 'autocompleteListPlugin:visibleChange' && !e.newVal) {"," acListHeight = 0;"," } else {"," acListHeight = input.ac.get('listNode').get('scrollHeight');"," }",""," // config from collapse"," transitionConfig = collapse.getAttrs(['duration', 'easing']);"," // add height to config, using base value and the current autocomplete list node height"," transitionConfig.height = baseCollapseHeight + acListHeight + 'px';",""," // transition using created config"," collapse.get('host').transition(transitionConfig);","","}","","var navbars = Y.all('.ues-navbar');","","if (navbars.size()) {"," navbars.each(function(node, i) {",""," // the autocomplete wrapper"," var wrapper = node.one('.autocomplete');"," // input which has autocomplete plugin"," var input;"," // autocomplete boundingbox"," var autoCompleteBox;",""," if(!wrapper) {"," return;"," }",""," input = wrapper.one('input[type=\"search\"]');"," if(!input) {"," throw new Error('autocomplete is missing input');"," }",""," // plug autocomplete"," input.plug(Y.Plugin.AutoComplete, {"," resultTextLocator: 'text',"," resultHighlighter: 'phraseMatch',"," tabSelect: true"," });",""," // whenever the autocomplete list node changes in height (or becomes invisible)"," // we need to change the height of the collapse"," input.ac.after(['clear', 'results', 'visibleChange'], afterAutoCompleteEvents, window, {"," collapse: wrapper.collapse,"," input: input"," });",""," // store collapse height the first time the collapse opens"," wrapper.collapse.once('open', function (e) {"," baseCollapseHeight = e.target.get('host').get('scrollHeight');"," });",""," // add ues classes"," autoCompleteBox = input.ac.get('boundingBox');"," autoCompleteBox.addClass('ues-autocomplete').addClass('ues-dropdown');"," autoCompleteBox.one('ul').addClass('ues-dropdown-menu');",""," // make ac control the visibility of the ues-dropdown"," input.ac.before('visibleChange', function (e) {"," autoCompleteBox.toggleClass('open', e.newVal);"," });",""," });","}","","})();","","","}, '0.0.1', {\"requires\": [\"node\", \"autocomplete\", \"autocomplete-highlighters\"]});","","}());"]}; |
18 | -} |
19 | -var __cov_pfkSlCzCqt6qzlcNmBUfxg = __coverage__['build/navbar-autocomplete/navbar-autocomplete.js']; |
20 | -__cov_pfkSlCzCqt6qzlcNmBUfxg.s['1']++;YUI.add('navbar-autocomplete',function(Y,NAME){'use strict';__cov_pfkSlCzCqt6qzlcNmBUfxg.f['1']++;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['2']++;(function(){__cov_pfkSlCzCqt6qzlcNmBUfxg.f['2']++;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['3']++;var baseCollapseHeight;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['4']++;function afterAutoCompleteEvents(e,args){__cov_pfkSlCzCqt6qzlcNmBUfxg.f['3']++;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['5']++;var transitionConfig;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['6']++;var acListHeight;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['7']++;var collapse=args.collapse;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['8']++;var input=args.input;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['9']++;if(!collapse.get('state')){__cov_pfkSlCzCqt6qzlcNmBUfxg.b['1'][0]++;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['10']++;return;}else{__cov_pfkSlCzCqt6qzlcNmBUfxg.b['1'][1]++;}__cov_pfkSlCzCqt6qzlcNmBUfxg.s['11']++;if(!baseCollapseHeight){__cov_pfkSlCzCqt6qzlcNmBUfxg.b['2'][0]++;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['12']++;throw new Error('baseCollapseHeight was falsy or 0');}else{__cov_pfkSlCzCqt6qzlcNmBUfxg.b['2'][1]++;}__cov_pfkSlCzCqt6qzlcNmBUfxg.s['13']++;if((__cov_pfkSlCzCqt6qzlcNmBUfxg.b['4'][0]++,e.type==='autocompleteListPlugin:visibleChange')&&(__cov_pfkSlCzCqt6qzlcNmBUfxg.b['4'][1]++,!e.newVal)){__cov_pfkSlCzCqt6qzlcNmBUfxg.b['3'][0]++;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['14']++;acListHeight=0;}else{__cov_pfkSlCzCqt6qzlcNmBUfxg.b['3'][1]++;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['15']++;acListHeight=input.ac.get('listNode').get('scrollHeight');}__cov_pfkSlCzCqt6qzlcNmBUfxg.s['16']++;transitionConfig=collapse.getAttrs(['duration','easing']);__cov_pfkSlCzCqt6qzlcNmBUfxg.s['17']++;transitionConfig.height=baseCollapseHeight+acListHeight+'px';__cov_pfkSlCzCqt6qzlcNmBUfxg.s['18']++;collapse.get('host').transition(transitionConfig);}__cov_pfkSlCzCqt6qzlcNmBUfxg.s['19']++;var navbars=Y.all('.ues-navbar');__cov_pfkSlCzCqt6qzlcNmBUfxg.s['20']++;if(navbars.size()){__cov_pfkSlCzCqt6qzlcNmBUfxg.b['5'][0]++;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['21']++;navbars.each(function(node,i){__cov_pfkSlCzCqt6qzlcNmBUfxg.f['4']++;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['22']++;var wrapper=node.one('.autocomplete');__cov_pfkSlCzCqt6qzlcNmBUfxg.s['23']++;var input;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['24']++;var autoCompleteBox;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['25']++;if(!wrapper){__cov_pfkSlCzCqt6qzlcNmBUfxg.b['6'][0]++;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['26']++;return;}else{__cov_pfkSlCzCqt6qzlcNmBUfxg.b['6'][1]++;}__cov_pfkSlCzCqt6qzlcNmBUfxg.s['27']++;input=wrapper.one('input[type="search"]');__cov_pfkSlCzCqt6qzlcNmBUfxg.s['28']++;if(!input){__cov_pfkSlCzCqt6qzlcNmBUfxg.b['7'][0]++;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['29']++;throw new Error('autocomplete is missing input');}else{__cov_pfkSlCzCqt6qzlcNmBUfxg.b['7'][1]++;}__cov_pfkSlCzCqt6qzlcNmBUfxg.s['30']++;input.plug(Y.Plugin.AutoComplete,{resultTextLocator:'text',resultHighlighter:'phraseMatch',tabSelect:true});__cov_pfkSlCzCqt6qzlcNmBUfxg.s['31']++;input.ac.after(['clear','results','visibleChange'],afterAutoCompleteEvents,window,{collapse:wrapper.collapse,input:input});__cov_pfkSlCzCqt6qzlcNmBUfxg.s['32']++;wrapper.collapse.once('open',function(e){__cov_pfkSlCzCqt6qzlcNmBUfxg.f['5']++;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['33']++;baseCollapseHeight=e.target.get('host').get('scrollHeight');});__cov_pfkSlCzCqt6qzlcNmBUfxg.s['34']++;autoCompleteBox=input.ac.get('boundingBox');__cov_pfkSlCzCqt6qzlcNmBUfxg.s['35']++;autoCompleteBox.addClass('ues-autocomplete').addClass('ues-dropdown');__cov_pfkSlCzCqt6qzlcNmBUfxg.s['36']++;autoCompleteBox.one('ul').addClass('ues-dropdown-menu');__cov_pfkSlCzCqt6qzlcNmBUfxg.s['37']++;input.ac.before('visibleChange',function(e){__cov_pfkSlCzCqt6qzlcNmBUfxg.f['6']++;__cov_pfkSlCzCqt6qzlcNmBUfxg.s['38']++;autoCompleteBox.toggleClass('open',e.newVal);});});}else{__cov_pfkSlCzCqt6qzlcNmBUfxg.b['5'][1]++;}}());},'0.0.1',{'requires':['node','autocomplete','autocomplete-highlighters']}); |
21 | |
22 | === removed file 'build/navbar-autocomplete/navbar-autocomplete-debug.js' |
23 | --- build/navbar-autocomplete/navbar-autocomplete-debug.js 2014-04-22 10:29:38 +0000 |
24 | +++ build/navbar-autocomplete/navbar-autocomplete-debug.js 1970-01-01 00:00:00 +0000 |
25 | @@ -1,109 +0,0 @@ |
26 | -YUI.add('navbar-autocomplete', function (Y, NAME) { |
27 | - |
28 | -"use strict"; |
29 | -(function() { |
30 | - |
31 | -// store height of collapse once opened |
32 | -var baseCollapseHeight; |
33 | - |
34 | -// whever something happens with re: to the autocomplete, |
35 | -// we need to change the height of the collapse to match the |
36 | -// length of the list |
37 | -function afterAutoCompleteEvents (e, args) { |
38 | - |
39 | - // transition config of collapse |
40 | - var transitionConfig; |
41 | - // height of autocomplete list node |
42 | - var acListHeight; |
43 | - // collapse itself |
44 | - var collapse = args.collapse; |
45 | - // input which has autocomplete plugin |
46 | - var input = args.input; |
47 | - |
48 | - // only calculate new height if autocomplete collapse is expanded |
49 | - if(!collapse.get('state')) { |
50 | - return; |
51 | - } |
52 | - |
53 | - // would only happen if collapse did not open properly |
54 | - if(!baseCollapseHeight) { |
55 | - throw new Error('baseCollapseHeight was falsy or 0'); |
56 | - } |
57 | - |
58 | - // list was made invisible |
59 | - if(e.type === 'autocompleteListPlugin:visibleChange' && !e.newVal) { |
60 | - acListHeight = 0; |
61 | - } else { |
62 | - acListHeight = input.ac.get('listNode').get('scrollHeight'); |
63 | - } |
64 | - |
65 | - // config from collapse |
66 | - transitionConfig = collapse.getAttrs(['duration', 'easing']); |
67 | - // add height to config, using base value and the current autocomplete list node height |
68 | - transitionConfig.height = baseCollapseHeight + acListHeight + 'px'; |
69 | - |
70 | - // transition using created config |
71 | - collapse.get('host').transition(transitionConfig); |
72 | - |
73 | - Y.log('collapse host height: ' + transitionConfig.height, 'debug', 'navbar-autocomplete'); |
74 | -} |
75 | - |
76 | -var navbars = Y.all('.ues-navbar'); |
77 | - |
78 | -if (navbars.size()) { |
79 | - navbars.each(function(node, i) { |
80 | - |
81 | - // the autocomplete wrapper |
82 | - var wrapper = node.one('.autocomplete'); |
83 | - // input which has autocomplete plugin |
84 | - var input; |
85 | - // autocomplete boundingbox |
86 | - var autoCompleteBox; |
87 | - |
88 | - if(!wrapper) { |
89 | - Y.log('no AutoComplete wrapper in navbar #' + i, 'debug', 'navbar-autocomplete'); |
90 | - return; |
91 | - } |
92 | - |
93 | - input = wrapper.one('input[type="search"]'); |
94 | - if(!input) { |
95 | - throw new Error('autocomplete is missing input'); |
96 | - } |
97 | - |
98 | - // plug autocomplete |
99 | - input.plug(Y.Plugin.AutoComplete, { |
100 | - resultTextLocator: 'text', |
101 | - resultHighlighter: 'phraseMatch', |
102 | - tabSelect: true |
103 | - }); |
104 | - |
105 | - // whenever the autocomplete list node changes in height (or becomes invisible) |
106 | - // we need to change the height of the collapse |
107 | - input.ac.after(['clear', 'results', 'visibleChange'], afterAutoCompleteEvents, window, { |
108 | - collapse: wrapper.collapse, |
109 | - input: input |
110 | - }); |
111 | - |
112 | - // store collapse height the first time the collapse opens |
113 | - wrapper.collapse.once('open', function (e) { |
114 | - baseCollapseHeight = e.target.get('host').get('scrollHeight'); |
115 | - Y.log('baseCollapseHeight: ' + baseCollapseHeight, 'debug', 'navbar-autocomplete'); |
116 | - }); |
117 | - |
118 | - // add ues classes |
119 | - autoCompleteBox = input.ac.get('boundingBox'); |
120 | - autoCompleteBox.addClass('ues-autocomplete').addClass('ues-dropdown'); |
121 | - autoCompleteBox.one('ul').addClass('ues-dropdown-menu'); |
122 | - |
123 | - // make ac control the visibility of the ues-dropdown |
124 | - input.ac.before('visibleChange', function (e) { |
125 | - autoCompleteBox.toggleClass('open', e.newVal); |
126 | - }); |
127 | - |
128 | - }); |
129 | -} |
130 | - |
131 | -})(); |
132 | - |
133 | - |
134 | -}, '0.0.1', {"requires": ["node", "autocomplete", "autocomplete-highlighters"]}); |
135 | |
136 | === removed file 'build/navbar-autocomplete/navbar-autocomplete-min.js' |
137 | --- build/navbar-autocomplete/navbar-autocomplete-min.js 2014-04-22 10:29:38 +0000 |
138 | +++ build/navbar-autocomplete/navbar-autocomplete-min.js 1970-01-01 00:00:00 +0000 |
139 | @@ -1,1 +0,0 @@ |
140 | -YUI.add("navbar-autocomplete",function(e,t){"use strict";(function(){function n(e,n){var r,i,s=n.collapse,o=n.input;if(!s.get("state"))return;if(!t)throw new Error("baseCollapseHeight was falsy or 0");e.type==="autocompleteListPlugin:visibleChange"&&!e.newVal?i=0:i=o.ac.get("listNode").get("scrollHeight"),r=s.getAttrs(["duration","easing"]),r.height=t+i+"px",s.get("host").transition(r)}var t,r=e.all(".ues-navbar");r.size()&&r.each(function(r,i){var s=r.one(".autocomplete"),o,u;if(!s)return;o=s.one('input[type="search"]');if(!o)throw new Error("autocomplete is missing input");o.plug(e.Plugin.AutoComplete,{resultTextLocator:"text",resultHighlighter:"phraseMatch",tabSelect:!0}),o.ac.after(["clear","results","visibleChange"],n,window,{collapse:s.collapse,input:o}),s.collapse.once("open",function(e){t=e.target.get("host").get("scrollHeight")}),u=o.ac.get("boundingBox"),u.addClass("ues-autocomplete").addClass("ues-dropdown"),u.one("ul").addClass("ues-dropdown-menu"),o.ac.before("visibleChange",function(e){u.toggleClass("open",e.newVal)})})})()},"0.0.1",{requires:["node","autocomplete","autocomplete-highlighters"]}); |
141 | |
142 | === removed file 'build/navbar-autocomplete/navbar-autocomplete.js' |
143 | --- build/navbar-autocomplete/navbar-autocomplete.js 2014-04-22 10:29:38 +0000 |
144 | +++ build/navbar-autocomplete/navbar-autocomplete.js 1970-01-01 00:00:00 +0000 |
145 | @@ -1,106 +0,0 @@ |
146 | -YUI.add('navbar-autocomplete', function (Y, NAME) { |
147 | - |
148 | -"use strict"; |
149 | -(function() { |
150 | - |
151 | -// store height of collapse once opened |
152 | -var baseCollapseHeight; |
153 | - |
154 | -// whever something happens with re: to the autocomplete, |
155 | -// we need to change the height of the collapse to match the |
156 | -// length of the list |
157 | -function afterAutoCompleteEvents (e, args) { |
158 | - |
159 | - // transition config of collapse |
160 | - var transitionConfig; |
161 | - // height of autocomplete list node |
162 | - var acListHeight; |
163 | - // collapse itself |
164 | - var collapse = args.collapse; |
165 | - // input which has autocomplete plugin |
166 | - var input = args.input; |
167 | - |
168 | - // only calculate new height if autocomplete collapse is expanded |
169 | - if(!collapse.get('state')) { |
170 | - return; |
171 | - } |
172 | - |
173 | - // would only happen if collapse did not open properly |
174 | - if(!baseCollapseHeight) { |
175 | - throw new Error('baseCollapseHeight was falsy or 0'); |
176 | - } |
177 | - |
178 | - // list was made invisible |
179 | - if(e.type === 'autocompleteListPlugin:visibleChange' && !e.newVal) { |
180 | - acListHeight = 0; |
181 | - } else { |
182 | - acListHeight = input.ac.get('listNode').get('scrollHeight'); |
183 | - } |
184 | - |
185 | - // config from collapse |
186 | - transitionConfig = collapse.getAttrs(['duration', 'easing']); |
187 | - // add height to config, using base value and the current autocomplete list node height |
188 | - transitionConfig.height = baseCollapseHeight + acListHeight + 'px'; |
189 | - |
190 | - // transition using created config |
191 | - collapse.get('host').transition(transitionConfig); |
192 | - |
193 | -} |
194 | - |
195 | -var navbars = Y.all('.ues-navbar'); |
196 | - |
197 | -if (navbars.size()) { |
198 | - navbars.each(function(node, i) { |
199 | - |
200 | - // the autocomplete wrapper |
201 | - var wrapper = node.one('.autocomplete'); |
202 | - // input which has autocomplete plugin |
203 | - var input; |
204 | - // autocomplete boundingbox |
205 | - var autoCompleteBox; |
206 | - |
207 | - if(!wrapper) { |
208 | - return; |
209 | - } |
210 | - |
211 | - input = wrapper.one('input[type="search"]'); |
212 | - if(!input) { |
213 | - throw new Error('autocomplete is missing input'); |
214 | - } |
215 | - |
216 | - // plug autocomplete |
217 | - input.plug(Y.Plugin.AutoComplete, { |
218 | - resultTextLocator: 'text', |
219 | - resultHighlighter: 'phraseMatch', |
220 | - tabSelect: true |
221 | - }); |
222 | - |
223 | - // whenever the autocomplete list node changes in height (or becomes invisible) |
224 | - // we need to change the height of the collapse |
225 | - input.ac.after(['clear', 'results', 'visibleChange'], afterAutoCompleteEvents, window, { |
226 | - collapse: wrapper.collapse, |
227 | - input: input |
228 | - }); |
229 | - |
230 | - // store collapse height the first time the collapse opens |
231 | - wrapper.collapse.once('open', function (e) { |
232 | - baseCollapseHeight = e.target.get('host').get('scrollHeight'); |
233 | - }); |
234 | - |
235 | - // add ues classes |
236 | - autoCompleteBox = input.ac.get('boundingBox'); |
237 | - autoCompleteBox.addClass('ues-autocomplete').addClass('ues-dropdown'); |
238 | - autoCompleteBox.one('ul').addClass('ues-dropdown-menu'); |
239 | - |
240 | - // make ac control the visibility of the ues-dropdown |
241 | - input.ac.before('visibleChange', function (e) { |
242 | - autoCompleteBox.toggleClass('open', e.newVal); |
243 | - }); |
244 | - |
245 | - }); |
246 | -} |
247 | - |
248 | -})(); |
249 | - |
250 | - |
251 | -}, '0.0.1', {"requires": ["node", "autocomplete", "autocomplete-highlighters"]}); |
252 | |
253 | === modified file 'build/navbar/navbar-coverage.js' |
254 | --- build/navbar/navbar-coverage.js 2014-04-16 13:48:47 +0000 |
255 | +++ build/navbar/navbar-coverage.js 2014-05-14 09:49:37 +0000 |
256 | @@ -1,6 +1,6 @@ |
257 | if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } |
258 | if (!__coverage__['build/navbar/navbar.js']) { |
259 | - __coverage__['build/navbar/navbar.js'] = {"path":"build/navbar/navbar.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":37}}},"2":{"name":"(anonymous_2)","line":15,"loc":{"start":{"line":15,"column":49},"end":{"line":15,"column":85}}},"3":{"name":"(anonymous_3)","line":29,"loc":{"start":{"line":29,"column":23},"end":{"line":29,"column":35}}},"4":{"name":"(anonymous_4)","line":36,"loc":{"start":{"line":36,"column":1},"end":{"line":36,"column":12}}},"5":{"name":"(anonymous_5)","line":41,"loc":{"start":{"line":41,"column":17},"end":{"line":41,"column":32}}},"6":{"name":"(anonymous_6)","line":66,"loc":{"start":{"line":66,"column":53},"end":{"line":66,"column":66}}},"7":{"name":"(anonymous_7)","line":67,"loc":{"start":{"line":67,"column":52},"end":{"line":67,"column":65}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":80,"column":55}},"2":{"start":{"line":15,"column":0},"end":{"line":34,"column":2}},"3":{"start":{"line":17,"column":4},"end":{"line":19,"column":5}},"4":{"start":{"line":18,"column":8},"end":{"line":18,"column":15}},"5":{"start":{"line":21,"column":4},"end":{"line":23,"column":5}},"6":{"start":{"line":22,"column":8},"end":{"line":22,"column":22}},"7":{"start":{"line":25,"column":4},"end":{"line":27,"column":7}},"8":{"start":{"line":29,"column":4},"end":{"line":32,"column":7}},"9":{"start":{"line":30,"column":8},"end":{"line":30,"column":27}},"10":{"start":{"line":31,"column":8},"end":{"line":31,"column":36}},"11":{"start":{"line":36,"column":0},"end":{"line":77,"column":5}},"12":{"start":{"line":38,"column":0},"end":{"line":38,"column":35}},"13":{"start":{"line":40,"column":0},"end":{"line":76,"column":1}},"14":{"start":{"line":41,"column":4},"end":{"line":75,"column":7}},"15":{"start":{"line":43,"column":8},"end":{"line":43,"column":52}},"16":{"start":{"line":45,"column":8},"end":{"line":47,"column":9}},"17":{"start":{"line":46,"column":12},"end":{"line":46,"column":50}},"18":{"start":{"line":49,"column":8},"end":{"line":49,"column":65}},"19":{"start":{"line":50,"column":8},"end":{"line":50,"column":61}},"20":{"start":{"line":52,"column":8},"end":{"line":56,"column":9}},"21":{"start":{"line":53,"column":12},"end":{"line":53,"column":80}},"22":{"start":{"line":54,"column":12},"end":{"line":54,"column":43}},"23":{"start":{"line":55,"column":12},"end":{"line":55,"column":64}},"24":{"start":{"line":58,"column":8},"end":{"line":62,"column":9}},"25":{"start":{"line":59,"column":12},"end":{"line":59,"column":93}},"26":{"start":{"line":60,"column":12},"end":{"line":60,"column":45}},"27":{"start":{"line":61,"column":12},"end":{"line":61,"column":68}},"28":{"start":{"line":65,"column":8},"end":{"line":73,"column":9}},"29":{"start":{"line":66,"column":12},"end":{"line":72,"column":15}},"30":{"start":{"line":67,"column":16},"end":{"line":71,"column":19}},"31":{"start":{"line":68,"column":20},"end":{"line":70,"column":21}},"32":{"start":{"line":69,"column":24},"end":{"line":69,"column":46}}},"branchMap":{"1":{"line":17,"type":"if","locations":[{"start":{"line":17,"column":4},"end":{"line":17,"column":4}},{"start":{"line":17,"column":4},"end":{"line":17,"column":4}}]},"2":{"line":17,"type":"binary-expr","locations":[{"start":{"line":17,"column":7},"end":{"line":17,"column":17}},{"start":{"line":17,"column":21},"end":{"line":17,"column":28}}]},"3":{"line":21,"type":"if","locations":[{"start":{"line":21,"column":4},"end":{"line":21,"column":4}},{"start":{"line":21,"column":4},"end":{"line":21,"column":4}}]},"4":{"line":40,"type":"if","locations":[{"start":{"line":40,"column":0},"end":{"line":40,"column":0}},{"start":{"line":40,"column":0},"end":{"line":40,"column":0}}]},"5":{"line":45,"type":"if","locations":[{"start":{"line":45,"column":8},"end":{"line":45,"column":8}},{"start":{"line":45,"column":8},"end":{"line":45,"column":8}}]},"6":{"line":52,"type":"if","locations":[{"start":{"line":52,"column":8},"end":{"line":52,"column":8}},{"start":{"line":52,"column":8},"end":{"line":52,"column":8}}]},"7":{"line":58,"type":"if","locations":[{"start":{"line":58,"column":8},"end":{"line":58,"column":8}},{"start":{"line":58,"column":8},"end":{"line":58,"column":8}}]},"8":{"line":65,"type":"if","locations":[{"start":{"line":65,"column":8},"end":{"line":65,"column":8}},{"start":{"line":65,"column":8},"end":{"line":65,"column":8}}]},"9":{"line":65,"type":"binary-expr","locations":[{"start":{"line":65,"column":11},"end":{"line":65,"column":15}},{"start":{"line":65,"column":19},"end":{"line":65,"column":25}}]},"10":{"line":68,"type":"if","locations":[{"start":{"line":68,"column":20},"end":{"line":68,"column":20}},{"start":{"line":68,"column":20},"end":{"line":68,"column":20}}]}},"code":["(function () { YUI.add('navbar', function (Y, NAME) {","","\"use strict\";","/**"," small screen navbar component, adds toggle, makes menu collapsable","*/","","/**"," * @method plugAndToggleSetupHelper"," * @param {Node} plug the node in which we want to plug Y.Plug.Collapse"," * @param {Node} toggle node which will toggle plug"," * @param {Boolean} state [state=false] initial collapse state"," * @static","*/","Y.namespace('navbar').plugAndToggleSetupHelper = function (pluggable, toggle, state) {",""," if(!pluggable || !toggle) {"," return;"," }",""," if (typeof state === 'undefined') {"," state = false;"," }",""," pluggable.plug(Y.Plugin.Collapse, {"," state: state"," });",""," toggle.on('click', function(e) {"," e.preventDefault();"," pluggable.collapse.toggle();"," });","","};","","(function() {","","var navbars = Y.all('.ues-navbar');","","if (navbars.size()) {"," navbars.each(function(node) {",""," var header = node.one('.ues-navbar-header');",""," if(!header) {"," throw new Error('missing header dom');"," }",""," var menu = node.one('.ues-navbar-collapse:not(.search)');"," var search = node.one('.ues-navbar-collapse.search');",""," if(menu) {"," var menuToggle = Y.Node.create('<div class=\"ues-icon-menu\"></div>');"," header.appendChild(menuToggle);"," Y.navbar.plugAndToggleSetupHelper(menu, menuToggle);"," }",""," if(search) {"," var searchToggle = Y.Node.create('<div class=\"ues-icon-search-bordered\"></div>');"," header.appendChild(searchToggle);"," Y.navbar.plugAndToggleSetupHelper(search, searchToggle);"," }",""," // if both menu and search, let one close the other on open"," if(menu && search) {"," Y.each([[menu, search], [search, menu]], function (n) {"," n[0].collapse.before('stateChange', function (e) {"," if(e.newVal) {"," n[1].collapse.close();"," }"," });"," });"," }",""," });","}","})();","","","}, '0.1.0', {\"requires\": [\"node\", \"plugin-collapse\"]});","","}());"]}; |
260 | + __coverage__['build/navbar/navbar.js'] = {"path":"build/navbar/navbar.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":37}}},"2":{"name":"(anonymous_2)","line":15,"loc":{"start":{"line":15,"column":49},"end":{"line":15,"column":85}}},"3":{"name":"(anonymous_3)","line":29,"loc":{"start":{"line":29,"column":23},"end":{"line":29,"column":35}}},"4":{"name":"(anonymous_4)","line":36,"loc":{"start":{"line":36,"column":1},"end":{"line":36,"column":12}}},"5":{"name":"(anonymous_5)","line":40,"loc":{"start":{"line":40,"column":13},"end":{"line":40,"column":28}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":61,"column":55}},"2":{"start":{"line":15,"column":0},"end":{"line":34,"column":2}},"3":{"start":{"line":17,"column":4},"end":{"line":19,"column":5}},"4":{"start":{"line":18,"column":8},"end":{"line":18,"column":15}},"5":{"start":{"line":21,"column":4},"end":{"line":23,"column":5}},"6":{"start":{"line":22,"column":8},"end":{"line":22,"column":22}},"7":{"start":{"line":25,"column":4},"end":{"line":27,"column":7}},"8":{"start":{"line":29,"column":4},"end":{"line":32,"column":7}},"9":{"start":{"line":30,"column":8},"end":{"line":30,"column":27}},"10":{"start":{"line":31,"column":8},"end":{"line":31,"column":36}},"11":{"start":{"line":36,"column":0},"end":{"line":58,"column":5}},"12":{"start":{"line":38,"column":0},"end":{"line":38,"column":35}},"13":{"start":{"line":40,"column":0},"end":{"line":56,"column":3}},"14":{"start":{"line":42,"column":4},"end":{"line":42,"column":48}},"15":{"start":{"line":44,"column":4},"end":{"line":46,"column":5}},"16":{"start":{"line":45,"column":8},"end":{"line":45,"column":46}},"17":{"start":{"line":48,"column":4},"end":{"line":48,"column":48}},"18":{"start":{"line":50,"column":4},"end":{"line":54,"column":5}},"19":{"start":{"line":51,"column":8},"end":{"line":51,"column":76}},"20":{"start":{"line":52,"column":8},"end":{"line":52,"column":39}},"21":{"start":{"line":53,"column":8},"end":{"line":53,"column":60}}},"branchMap":{"1":{"line":17,"type":"if","locations":[{"start":{"line":17,"column":4},"end":{"line":17,"column":4}},{"start":{"line":17,"column":4},"end":{"line":17,"column":4}}]},"2":{"line":17,"type":"binary-expr","locations":[{"start":{"line":17,"column":7},"end":{"line":17,"column":17}},{"start":{"line":17,"column":21},"end":{"line":17,"column":28}}]},"3":{"line":21,"type":"if","locations":[{"start":{"line":21,"column":4},"end":{"line":21,"column":4}},{"start":{"line":21,"column":4},"end":{"line":21,"column":4}}]},"4":{"line":44,"type":"if","locations":[{"start":{"line":44,"column":4},"end":{"line":44,"column":4}},{"start":{"line":44,"column":4},"end":{"line":44,"column":4}}]},"5":{"line":50,"type":"if","locations":[{"start":{"line":50,"column":4},"end":{"line":50,"column":4}},{"start":{"line":50,"column":4},"end":{"line":50,"column":4}}]}},"code":["(function () { YUI.add('navbar', function (Y, NAME) {","","\"use strict\";","/**"," small screen navbar component, adds toggle, makes menu collapsable","*/","","/**"," * @method plugAndToggleSetupHelper"," * @param {Node} plug the node in which we want to plug Y.Plug.Collapse"," * @param {Node} toggle node which will toggle plug"," * @param {Boolean} state [state=false] initial collapse state"," * @static","*/","Y.namespace('navbar').plugAndToggleSetupHelper = function (pluggable, toggle, state) {",""," if(!pluggable || !toggle) {"," return;"," }",""," if (typeof state === 'undefined') {"," state = false;"," }",""," pluggable.plug(Y.Plugin.Collapse, {"," state: state"," });",""," toggle.on('click', function(e) {"," e.preventDefault();"," pluggable.collapse.toggle();"," });","","};","","(function() {","","var navbars = Y.all('.ues-navbar');","","navbars.each(function(node) {",""," var header = node.one('.ues-navbar-header');",""," if(!header) {"," throw new Error('missing header dom');"," }",""," var menu = node.one('.ues-navbar-collapse');",""," if(menu) {"," var menuToggle = Y.Node.create('<div class=\"ues-icon-menu\"></div>');"," header.appendChild(menuToggle);"," Y.navbar.plugAndToggleSetupHelper(menu, menuToggle);"," }","","});","","})();","","","}, '0.2.0', {\"requires\": [\"node\", \"plugin-collapse\"]});","","}());"]}; |
261 | } |
262 | var __cov_fMohtqvShmUu2r5lLACdEA = __coverage__['build/navbar/navbar.js']; |
263 | -__cov_fMohtqvShmUu2r5lLACdEA.s['1']++;YUI.add('navbar',function(Y,NAME){'use strict';__cov_fMohtqvShmUu2r5lLACdEA.f['1']++;__cov_fMohtqvShmUu2r5lLACdEA.s['2']++;Y.namespace('navbar').plugAndToggleSetupHelper=function(pluggable,toggle,state){__cov_fMohtqvShmUu2r5lLACdEA.f['2']++;__cov_fMohtqvShmUu2r5lLACdEA.s['3']++;if((__cov_fMohtqvShmUu2r5lLACdEA.b['2'][0]++,!pluggable)||(__cov_fMohtqvShmUu2r5lLACdEA.b['2'][1]++,!toggle)){__cov_fMohtqvShmUu2r5lLACdEA.b['1'][0]++;__cov_fMohtqvShmUu2r5lLACdEA.s['4']++;return;}else{__cov_fMohtqvShmUu2r5lLACdEA.b['1'][1]++;}__cov_fMohtqvShmUu2r5lLACdEA.s['5']++;if(typeof state==='undefined'){__cov_fMohtqvShmUu2r5lLACdEA.b['3'][0]++;__cov_fMohtqvShmUu2r5lLACdEA.s['6']++;state=false;}else{__cov_fMohtqvShmUu2r5lLACdEA.b['3'][1]++;}__cov_fMohtqvShmUu2r5lLACdEA.s['7']++;pluggable.plug(Y.Plugin.Collapse,{state:state});__cov_fMohtqvShmUu2r5lLACdEA.s['8']++;toggle.on('click',function(e){__cov_fMohtqvShmUu2r5lLACdEA.f['3']++;__cov_fMohtqvShmUu2r5lLACdEA.s['9']++;e.preventDefault();__cov_fMohtqvShmUu2r5lLACdEA.s['10']++;pluggable.collapse.toggle();});};__cov_fMohtqvShmUu2r5lLACdEA.s['11']++;(function(){__cov_fMohtqvShmUu2r5lLACdEA.f['4']++;__cov_fMohtqvShmUu2r5lLACdEA.s['12']++;var navbars=Y.all('.ues-navbar');__cov_fMohtqvShmUu2r5lLACdEA.s['13']++;if(navbars.size()){__cov_fMohtqvShmUu2r5lLACdEA.b['4'][0]++;__cov_fMohtqvShmUu2r5lLACdEA.s['14']++;navbars.each(function(node){__cov_fMohtqvShmUu2r5lLACdEA.f['5']++;__cov_fMohtqvShmUu2r5lLACdEA.s['15']++;var header=node.one('.ues-navbar-header');__cov_fMohtqvShmUu2r5lLACdEA.s['16']++;if(!header){__cov_fMohtqvShmUu2r5lLACdEA.b['5'][0]++;__cov_fMohtqvShmUu2r5lLACdEA.s['17']++;throw new Error('missing header dom');}else{__cov_fMohtqvShmUu2r5lLACdEA.b['5'][1]++;}__cov_fMohtqvShmUu2r5lLACdEA.s['18']++;var menu=node.one('.ues-navbar-collapse:not(.search)');__cov_fMohtqvShmUu2r5lLACdEA.s['19']++;var search=node.one('.ues-navbar-collapse.search');__cov_fMohtqvShmUu2r5lLACdEA.s['20']++;if(menu){__cov_fMohtqvShmUu2r5lLACdEA.b['6'][0]++;__cov_fMohtqvShmUu2r5lLACdEA.s['21']++;var menuToggle=Y.Node.create('<div class="ues-icon-menu"></div>');__cov_fMohtqvShmUu2r5lLACdEA.s['22']++;header.appendChild(menuToggle);__cov_fMohtqvShmUu2r5lLACdEA.s['23']++;Y.navbar.plugAndToggleSetupHelper(menu,menuToggle);}else{__cov_fMohtqvShmUu2r5lLACdEA.b['6'][1]++;}__cov_fMohtqvShmUu2r5lLACdEA.s['24']++;if(search){__cov_fMohtqvShmUu2r5lLACdEA.b['7'][0]++;__cov_fMohtqvShmUu2r5lLACdEA.s['25']++;var searchToggle=Y.Node.create('<div class="ues-icon-search-bordered"></div>');__cov_fMohtqvShmUu2r5lLACdEA.s['26']++;header.appendChild(searchToggle);__cov_fMohtqvShmUu2r5lLACdEA.s['27']++;Y.navbar.plugAndToggleSetupHelper(search,searchToggle);}else{__cov_fMohtqvShmUu2r5lLACdEA.b['7'][1]++;}__cov_fMohtqvShmUu2r5lLACdEA.s['28']++;if((__cov_fMohtqvShmUu2r5lLACdEA.b['9'][0]++,menu)&&(__cov_fMohtqvShmUu2r5lLACdEA.b['9'][1]++,search)){__cov_fMohtqvShmUu2r5lLACdEA.b['8'][0]++;__cov_fMohtqvShmUu2r5lLACdEA.s['29']++;Y.each([[menu,search],[search,menu]],function(n){__cov_fMohtqvShmUu2r5lLACdEA.f['6']++;__cov_fMohtqvShmUu2r5lLACdEA.s['30']++;n[0].collapse.before('stateChange',function(e){__cov_fMohtqvShmUu2r5lLACdEA.f['7']++;__cov_fMohtqvShmUu2r5lLACdEA.s['31']++;if(e.newVal){__cov_fMohtqvShmUu2r5lLACdEA.b['10'][0]++;__cov_fMohtqvShmUu2r5lLACdEA.s['32']++;n[1].collapse.close();}else{__cov_fMohtqvShmUu2r5lLACdEA.b['10'][1]++;}});});}else{__cov_fMohtqvShmUu2r5lLACdEA.b['8'][1]++;}});}else{__cov_fMohtqvShmUu2r5lLACdEA.b['4'][1]++;}}());},'0.1.0',{'requires':['node','plugin-collapse']}); |
264 | +__cov_fMohtqvShmUu2r5lLACdEA.s['1']++;YUI.add('navbar',function(Y,NAME){'use strict';__cov_fMohtqvShmUu2r5lLACdEA.f['1']++;__cov_fMohtqvShmUu2r5lLACdEA.s['2']++;Y.namespace('navbar').plugAndToggleSetupHelper=function(pluggable,toggle,state){__cov_fMohtqvShmUu2r5lLACdEA.f['2']++;__cov_fMohtqvShmUu2r5lLACdEA.s['3']++;if((__cov_fMohtqvShmUu2r5lLACdEA.b['2'][0]++,!pluggable)||(__cov_fMohtqvShmUu2r5lLACdEA.b['2'][1]++,!toggle)){__cov_fMohtqvShmUu2r5lLACdEA.b['1'][0]++;__cov_fMohtqvShmUu2r5lLACdEA.s['4']++;return;}else{__cov_fMohtqvShmUu2r5lLACdEA.b['1'][1]++;}__cov_fMohtqvShmUu2r5lLACdEA.s['5']++;if(typeof state==='undefined'){__cov_fMohtqvShmUu2r5lLACdEA.b['3'][0]++;__cov_fMohtqvShmUu2r5lLACdEA.s['6']++;state=false;}else{__cov_fMohtqvShmUu2r5lLACdEA.b['3'][1]++;}__cov_fMohtqvShmUu2r5lLACdEA.s['7']++;pluggable.plug(Y.Plugin.Collapse,{state:state});__cov_fMohtqvShmUu2r5lLACdEA.s['8']++;toggle.on('click',function(e){__cov_fMohtqvShmUu2r5lLACdEA.f['3']++;__cov_fMohtqvShmUu2r5lLACdEA.s['9']++;e.preventDefault();__cov_fMohtqvShmUu2r5lLACdEA.s['10']++;pluggable.collapse.toggle();});};__cov_fMohtqvShmUu2r5lLACdEA.s['11']++;(function(){__cov_fMohtqvShmUu2r5lLACdEA.f['4']++;__cov_fMohtqvShmUu2r5lLACdEA.s['12']++;var navbars=Y.all('.ues-navbar');__cov_fMohtqvShmUu2r5lLACdEA.s['13']++;navbars.each(function(node){__cov_fMohtqvShmUu2r5lLACdEA.f['5']++;__cov_fMohtqvShmUu2r5lLACdEA.s['14']++;var header=node.one('.ues-navbar-header');__cov_fMohtqvShmUu2r5lLACdEA.s['15']++;if(!header){__cov_fMohtqvShmUu2r5lLACdEA.b['4'][0]++;__cov_fMohtqvShmUu2r5lLACdEA.s['16']++;throw new Error('missing header dom');}else{__cov_fMohtqvShmUu2r5lLACdEA.b['4'][1]++;}__cov_fMohtqvShmUu2r5lLACdEA.s['17']++;var menu=node.one('.ues-navbar-collapse');__cov_fMohtqvShmUu2r5lLACdEA.s['18']++;if(menu){__cov_fMohtqvShmUu2r5lLACdEA.b['5'][0]++;__cov_fMohtqvShmUu2r5lLACdEA.s['19']++;var menuToggle=Y.Node.create('<div class="ues-icon-menu"></div>');__cov_fMohtqvShmUu2r5lLACdEA.s['20']++;header.appendChild(menuToggle);__cov_fMohtqvShmUu2r5lLACdEA.s['21']++;Y.navbar.plugAndToggleSetupHelper(menu,menuToggle);}else{__cov_fMohtqvShmUu2r5lLACdEA.b['5'][1]++;}});}());},'0.2.0',{'requires':['node','plugin-collapse']}); |
265 | |
266 | === modified file 'build/navbar/navbar-debug.js' |
267 | --- build/navbar/navbar-debug.js 2014-04-16 13:48:47 +0000 |
268 | +++ build/navbar/navbar-debug.js 2014-05-14 09:49:37 +0000 |
269 | @@ -38,44 +38,25 @@ |
270 | |
271 | var navbars = Y.all('.ues-navbar'); |
272 | |
273 | -if (navbars.size()) { |
274 | - navbars.each(function(node) { |
275 | - |
276 | - var header = node.one('.ues-navbar-header'); |
277 | - |
278 | - if(!header) { |
279 | - throw new Error('missing header dom'); |
280 | - } |
281 | - |
282 | - var menu = node.one('.ues-navbar-collapse:not(.search)'); |
283 | - var search = node.one('.ues-navbar-collapse.search'); |
284 | - |
285 | - if(menu) { |
286 | - var menuToggle = Y.Node.create('<div class="ues-icon-menu"></div>'); |
287 | - header.appendChild(menuToggle); |
288 | - Y.navbar.plugAndToggleSetupHelper(menu, menuToggle); |
289 | - } |
290 | - |
291 | - if(search) { |
292 | - var searchToggle = Y.Node.create('<div class="ues-icon-search-bordered"></div>'); |
293 | - header.appendChild(searchToggle); |
294 | - Y.navbar.plugAndToggleSetupHelper(search, searchToggle); |
295 | - } |
296 | - |
297 | - // if both menu and search, let one close the other on open |
298 | - if(menu && search) { |
299 | - Y.each([[menu, search], [search, menu]], function (n) { |
300 | - n[0].collapse.before('stateChange', function (e) { |
301 | - if(e.newVal) { |
302 | - n[1].collapse.close(); |
303 | - } |
304 | - }); |
305 | - }); |
306 | - } |
307 | - |
308 | - }); |
309 | -} |
310 | +navbars.each(function(node) { |
311 | + |
312 | + var header = node.one('.ues-navbar-header'); |
313 | + |
314 | + if(!header) { |
315 | + throw new Error('missing header dom'); |
316 | + } |
317 | + |
318 | + var menu = node.one('.ues-navbar-collapse'); |
319 | + |
320 | + if(menu) { |
321 | + var menuToggle = Y.Node.create('<div class="ues-icon-menu"></div>'); |
322 | + header.appendChild(menuToggle); |
323 | + Y.navbar.plugAndToggleSetupHelper(menu, menuToggle); |
324 | + } |
325 | + |
326 | +}); |
327 | + |
328 | })(); |
329 | |
330 | |
331 | -}, '0.1.0', {"requires": ["node", "plugin-collapse"]}); |
332 | +}, '0.2.0', {"requires": ["node", "plugin-collapse"]}); |
333 | |
334 | === modified file 'build/navbar/navbar-min.js' |
335 | --- build/navbar/navbar-min.js 2014-04-16 13:48:47 +0000 |
336 | +++ build/navbar/navbar-min.js 2014-05-14 09:49:37 +0000 |
337 | @@ -1,1 +1,1 @@ |
338 | -YUI.add("navbar",function(e,t){"use strict";e.namespace("navbar").plugAndToggleSetupHelper=function(t,n,r){if(!t||!n)return;typeof r=="undefined"&&(r=!1),t.plug(e.Plugin.Collapse,{state:r}),n.on("click",function(e){e.preventDefault(),t.collapse.toggle()})},function(){var t=e.all(".ues-navbar");t.size()&&t.each(function(t){var n=t.one(".ues-navbar-header");if(!n)throw new Error("missing header dom");var r=t.one(".ues-navbar-collapse:not(.search)"),i=t.one(".ues-navbar-collapse.search");if(r){var s=e.Node.create('<div class="ues-icon-menu"></div>');n.appendChild(s),e.navbar.plugAndToggleSetupHelper(r,s)}if(i){var o=e.Node.create('<div class="ues-icon-search-bordered"></div>');n.appendChild(o),e.navbar.plugAndToggleSetupHelper(i,o)}r&&i&&e.each([[r,i],[i,r]],function(e){e[0].collapse.before("stateChange",function(t){t.newVal&&e[1].collapse.close()})})})}()},"0.1.0",{requires:["node","plugin-collapse"]}); |
339 | +YUI.add("navbar",function(e,t){"use strict";e.namespace("navbar").plugAndToggleSetupHelper=function(t,n,r){if(!t||!n)return;typeof r=="undefined"&&(r=!1),t.plug(e.Plugin.Collapse,{state:r}),n.on("click",function(e){e.preventDefault(),t.collapse.toggle()})},function(){var t=e.all(".ues-navbar");t.each(function(t){var n=t.one(".ues-navbar-header");if(!n)throw new Error("missing header dom");var r=t.one(".ues-navbar-collapse");if(r){var i=e.Node.create('<div class="ues-icon-menu"></div>');n.appendChild(i),e.navbar.plugAndToggleSetupHelper(r,i)}})}()},"0.2.0",{requires:["node","plugin-collapse"]}); |
340 | |
341 | === modified file 'build/navbar/navbar.js' |
342 | --- build/navbar/navbar.js 2014-04-16 13:48:47 +0000 |
343 | +++ build/navbar/navbar.js 2014-05-14 09:49:37 +0000 |
344 | @@ -37,44 +37,25 @@ |
345 | |
346 | var navbars = Y.all('.ues-navbar'); |
347 | |
348 | -if (navbars.size()) { |
349 | - navbars.each(function(node) { |
350 | - |
351 | - var header = node.one('.ues-navbar-header'); |
352 | - |
353 | - if(!header) { |
354 | - throw new Error('missing header dom'); |
355 | - } |
356 | - |
357 | - var menu = node.one('.ues-navbar-collapse:not(.search)'); |
358 | - var search = node.one('.ues-navbar-collapse.search'); |
359 | - |
360 | - if(menu) { |
361 | - var menuToggle = Y.Node.create('<div class="ues-icon-menu"></div>'); |
362 | - header.appendChild(menuToggle); |
363 | - Y.navbar.plugAndToggleSetupHelper(menu, menuToggle); |
364 | - } |
365 | - |
366 | - if(search) { |
367 | - var searchToggle = Y.Node.create('<div class="ues-icon-search-bordered"></div>'); |
368 | - header.appendChild(searchToggle); |
369 | - Y.navbar.plugAndToggleSetupHelper(search, searchToggle); |
370 | - } |
371 | - |
372 | - // if both menu and search, let one close the other on open |
373 | - if(menu && search) { |
374 | - Y.each([[menu, search], [search, menu]], function (n) { |
375 | - n[0].collapse.before('stateChange', function (e) { |
376 | - if(e.newVal) { |
377 | - n[1].collapse.close(); |
378 | - } |
379 | - }); |
380 | - }); |
381 | - } |
382 | - |
383 | - }); |
384 | -} |
385 | +navbars.each(function(node) { |
386 | + |
387 | + var header = node.one('.ues-navbar-header'); |
388 | + |
389 | + if(!header) { |
390 | + throw new Error('missing header dom'); |
391 | + } |
392 | + |
393 | + var menu = node.one('.ues-navbar-collapse'); |
394 | + |
395 | + if(menu) { |
396 | + var menuToggle = Y.Node.create('<div class="ues-icon-menu"></div>'); |
397 | + header.appendChild(menuToggle); |
398 | + Y.navbar.plugAndToggleSetupHelper(menu, menuToggle); |
399 | + } |
400 | + |
401 | +}); |
402 | + |
403 | })(); |
404 | |
405 | |
406 | -}, '0.1.0', {"requires": ["node", "plugin-collapse"]}); |
407 | +}, '0.2.0', {"requires": ["node", "plugin-collapse"]}); |
408 | |
409 | === added directory 'build/searchbar-autocomplete' |
410 | === added file 'build/searchbar-autocomplete/searchbar-autocomplete-coverage.js' |
411 | --- build/searchbar-autocomplete/searchbar-autocomplete-coverage.js 1970-01-01 00:00:00 +0000 |
412 | +++ build/searchbar-autocomplete/searchbar-autocomplete-coverage.js 2014-05-14 09:49:37 +0000 |
413 | @@ -0,0 +1,6 @@ |
414 | +if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } |
415 | +if (!__coverage__['build/searchbar-autocomplete/searchbar-autocomplete.js']) { |
416 | + __coverage__['build/searchbar-autocomplete/searchbar-autocomplete.js'] = {"path":"build/searchbar-autocomplete/searchbar-autocomplete.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0},"b":{"1":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":53}}},"2":{"name":"(anonymous_2)","line":4,"loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":13}}},"3":{"name":"(anonymous_3)","line":8,"loc":{"start":{"line":8,"column":16},"end":{"line":8,"column":35}}},"4":{"name":"(anonymous_4)","line":34,"loc":{"start":{"line":34,"column":37},"end":{"line":34,"column":50}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":43,"column":52}},"2":{"start":{"line":4,"column":0},"end":{"line":40,"column":5}},"3":{"start":{"line":6,"column":0},"end":{"line":6,"column":41}},"4":{"start":{"line":8,"column":0},"end":{"line":38,"column":3}},"5":{"start":{"line":11,"column":4},"end":{"line":11,"column":14}},"6":{"start":{"line":13,"column":4},"end":{"line":13,"column":24}},"7":{"start":{"line":15,"column":4},"end":{"line":15,"column":45}},"8":{"start":{"line":16,"column":4},"end":{"line":18,"column":5}},"9":{"start":{"line":17,"column":8},"end":{"line":17,"column":57}},"10":{"start":{"line":21,"column":4},"end":{"line":25,"column":7}},"11":{"start":{"line":28,"column":4},"end":{"line":28,"column":50}},"12":{"start":{"line":29,"column":4},"end":{"line":29,"column":74}},"13":{"start":{"line":30,"column":4},"end":{"line":30,"column":60}},"14":{"start":{"line":31,"column":4},"end":{"line":31,"column":46}},"15":{"start":{"line":34,"column":4},"end":{"line":36,"column":7}},"16":{"start":{"line":35,"column":8},"end":{"line":35,"column":54}}},"branchMap":{"1":{"line":16,"type":"if","locations":[{"start":{"line":16,"column":4},"end":{"line":16,"column":4}},{"start":{"line":16,"column":4},"end":{"line":16,"column":4}}]}},"code":["(function () { YUI.add('searchbar-autocomplete', function (Y, NAME) {","","\"use strict\";","(function () {","","var searchbars = Y.all('.ues-searchbar');","","searchbars.each(function (node, i) {",""," // input which has autocomplete plugin"," var input;"," // autocomplete boundingbox"," var autoCompleteBox;",""," input = node.one('input[type=\"search\"]');"," if (!input) {"," throw new Error('autocomplete is missing input');"," }",""," // plug autocomplete"," input.plug(Y.Plugin.AutoComplete, {"," resultTextLocator: 'text',"," resultHighlighter: 'phraseMatch',"," tabSelect: true"," });",""," // add ues classes"," autoCompleteBox = input.ac.get('boundingBox');"," autoCompleteBox.addClass('ues-autocomplete').addClass('ues-dropdown');"," autoCompleteBox.one('ul').addClass('ues-dropdown-menu');"," autoCompleteBox.setStyle('width', '100%');",""," // make ac control the visibility of the ues-dropdown"," input.ac.before('visibleChange', function (e) {"," autoCompleteBox.toggleClass('open', e.newVal);"," });","","});","","})();","","","}, '0.1.0', {\"requires\": [\"node\", \"autocomplete\"]});","","}());"]}; |
417 | +} |
418 | +var __cov_g0Tq0C64FsLqcF2cRssBmw = __coverage__['build/searchbar-autocomplete/searchbar-autocomplete.js']; |
419 | +__cov_g0Tq0C64FsLqcF2cRssBmw.s['1']++;YUI.add('searchbar-autocomplete',function(Y,NAME){'use strict';__cov_g0Tq0C64FsLqcF2cRssBmw.f['1']++;__cov_g0Tq0C64FsLqcF2cRssBmw.s['2']++;(function(){__cov_g0Tq0C64FsLqcF2cRssBmw.f['2']++;__cov_g0Tq0C64FsLqcF2cRssBmw.s['3']++;var searchbars=Y.all('.ues-searchbar');__cov_g0Tq0C64FsLqcF2cRssBmw.s['4']++;searchbars.each(function(node,i){__cov_g0Tq0C64FsLqcF2cRssBmw.f['3']++;__cov_g0Tq0C64FsLqcF2cRssBmw.s['5']++;var input;__cov_g0Tq0C64FsLqcF2cRssBmw.s['6']++;var autoCompleteBox;__cov_g0Tq0C64FsLqcF2cRssBmw.s['7']++;input=node.one('input[type="search"]');__cov_g0Tq0C64FsLqcF2cRssBmw.s['8']++;if(!input){__cov_g0Tq0C64FsLqcF2cRssBmw.b['1'][0]++;__cov_g0Tq0C64FsLqcF2cRssBmw.s['9']++;throw new Error('autocomplete is missing input');}else{__cov_g0Tq0C64FsLqcF2cRssBmw.b['1'][1]++;}__cov_g0Tq0C64FsLqcF2cRssBmw.s['10']++;input.plug(Y.Plugin.AutoComplete,{resultTextLocator:'text',resultHighlighter:'phraseMatch',tabSelect:true});__cov_g0Tq0C64FsLqcF2cRssBmw.s['11']++;autoCompleteBox=input.ac.get('boundingBox');__cov_g0Tq0C64FsLqcF2cRssBmw.s['12']++;autoCompleteBox.addClass('ues-autocomplete').addClass('ues-dropdown');__cov_g0Tq0C64FsLqcF2cRssBmw.s['13']++;autoCompleteBox.one('ul').addClass('ues-dropdown-menu');__cov_g0Tq0C64FsLqcF2cRssBmw.s['14']++;autoCompleteBox.setStyle('width','100%');__cov_g0Tq0C64FsLqcF2cRssBmw.s['15']++;input.ac.before('visibleChange',function(e){__cov_g0Tq0C64FsLqcF2cRssBmw.f['4']++;__cov_g0Tq0C64FsLqcF2cRssBmw.s['16']++;autoCompleteBox.toggleClass('open',e.newVal);});});}());},'0.1.0',{'requires':['node','autocomplete']}); |
420 | |
421 | === added file 'build/searchbar-autocomplete/searchbar-autocomplete-debug.js' |
422 | --- build/searchbar-autocomplete/searchbar-autocomplete-debug.js 1970-01-01 00:00:00 +0000 |
423 | +++ build/searchbar-autocomplete/searchbar-autocomplete-debug.js 2014-05-14 09:49:37 +0000 |
424 | @@ -0,0 +1,43 @@ |
425 | +YUI.add('searchbar-autocomplete', function (Y, NAME) { |
426 | + |
427 | +"use strict"; |
428 | +(function () { |
429 | + |
430 | +var searchbars = Y.all('.ues-searchbar'); |
431 | + |
432 | +searchbars.each(function (node, i) { |
433 | + |
434 | + // input which has autocomplete plugin |
435 | + var input; |
436 | + // autocomplete boundingbox |
437 | + var autoCompleteBox; |
438 | + |
439 | + input = node.one('input[type="search"]'); |
440 | + if (!input) { |
441 | + throw new Error('autocomplete is missing input'); |
442 | + } |
443 | + |
444 | + // plug autocomplete |
445 | + input.plug(Y.Plugin.AutoComplete, { |
446 | + resultTextLocator: 'text', |
447 | + resultHighlighter: 'phraseMatch', |
448 | + tabSelect: true |
449 | + }); |
450 | + |
451 | + // add ues classes |
452 | + autoCompleteBox = input.ac.get('boundingBox'); |
453 | + autoCompleteBox.addClass('ues-autocomplete').addClass('ues-dropdown'); |
454 | + autoCompleteBox.one('ul').addClass('ues-dropdown-menu'); |
455 | + autoCompleteBox.setStyle('width', '100%'); |
456 | + |
457 | + // make ac control the visibility of the ues-dropdown |
458 | + input.ac.before('visibleChange', function (e) { |
459 | + autoCompleteBox.toggleClass('open', e.newVal); |
460 | + }); |
461 | + |
462 | +}); |
463 | + |
464 | +})(); |
465 | + |
466 | + |
467 | +}, '0.1.0', {"requires": ["node", "autocomplete"]}); |
468 | |
469 | === added file 'build/searchbar-autocomplete/searchbar-autocomplete-min.js' |
470 | --- build/searchbar-autocomplete/searchbar-autocomplete-min.js 1970-01-01 00:00:00 +0000 |
471 | +++ build/searchbar-autocomplete/searchbar-autocomplete-min.js 2014-05-14 09:49:37 +0000 |
472 | @@ -0,0 +1,1 @@ |
473 | +YUI.add("searchbar-autocomplete",function(e,t){"use strict";(function(){var t=e.all(".ues-searchbar");t.each(function(t,n){var r,i;r=t.one('input[type="search"]');if(!r)throw new Error("autocomplete is missing input");r.plug(e.Plugin.AutoComplete,{resultTextLocator:"text",resultHighlighter:"phraseMatch",tabSelect:!0}),i=r.ac.get("boundingBox"),i.addClass("ues-autocomplete").addClass("ues-dropdown"),i.one("ul").addClass("ues-dropdown-menu"),i.setStyle("width","100%"),r.ac.before("visibleChange",function(e){i.toggleClass("open",e.newVal)})})})()},"0.1.0",{requires:["node","autocomplete"]}); |
474 | |
475 | === added file 'build/searchbar-autocomplete/searchbar-autocomplete.js' |
476 | --- build/searchbar-autocomplete/searchbar-autocomplete.js 1970-01-01 00:00:00 +0000 |
477 | +++ build/searchbar-autocomplete/searchbar-autocomplete.js 2014-05-14 09:49:37 +0000 |
478 | @@ -0,0 +1,43 @@ |
479 | +YUI.add('searchbar-autocomplete', function (Y, NAME) { |
480 | + |
481 | +"use strict"; |
482 | +(function () { |
483 | + |
484 | +var searchbars = Y.all('.ues-searchbar'); |
485 | + |
486 | +searchbars.each(function (node, i) { |
487 | + |
488 | + // input which has autocomplete plugin |
489 | + var input; |
490 | + // autocomplete boundingbox |
491 | + var autoCompleteBox; |
492 | + |
493 | + input = node.one('input[type="search"]'); |
494 | + if (!input) { |
495 | + throw new Error('autocomplete is missing input'); |
496 | + } |
497 | + |
498 | + // plug autocomplete |
499 | + input.plug(Y.Plugin.AutoComplete, { |
500 | + resultTextLocator: 'text', |
501 | + resultHighlighter: 'phraseMatch', |
502 | + tabSelect: true |
503 | + }); |
504 | + |
505 | + // add ues classes |
506 | + autoCompleteBox = input.ac.get('boundingBox'); |
507 | + autoCompleteBox.addClass('ues-autocomplete').addClass('ues-dropdown'); |
508 | + autoCompleteBox.one('ul').addClass('ues-dropdown-menu'); |
509 | + autoCompleteBox.setStyle('width', '100%'); |
510 | + |
511 | + // make ac control the visibility of the ues-dropdown |
512 | + input.ac.before('visibleChange', function (e) { |
513 | + autoCompleteBox.toggleClass('open', e.newVal); |
514 | + }); |
515 | + |
516 | +}); |
517 | + |
518 | +})(); |
519 | + |
520 | + |
521 | +}, '0.1.0', {"requires": ["node", "autocomplete"]}); |
522 | |
523 | === modified file 'config-manager.txt' |
524 | --- config-manager.txt 2014-04-16 13:48:47 +0000 |
525 | +++ config-manager.txt 2014-05-14 09:49:37 +0000 |
526 | @@ -1,1 +1,1 @@ |
527 | -branches/ulysses bzr+ssh://bazaar.launchpad.net/~ubuntuone-hackers/ulysses/trunk;revno=39 |
528 | +branches/ulysses bzr+ssh://bazaar.launchpad.net/~ubuntuone-hackers/ulysses/trunk;revno=42 |
529 | |
530 | === modified file 'src/navbar/build.json' |
531 | --- src/navbar/build.json 2014-05-01 15:38:15 +0000 |
532 | +++ src/navbar/build.json 2014-05-14 09:49:37 +0000 |
533 | @@ -6,7 +6,7 @@ |
534 | "./js/navbar.js" |
535 | ], |
536 | "replace": { |
537 | - "@VERSION@": "0.1.0" |
538 | + "@VERSION@": "0.2.0" |
539 | }, |
540 | "skinnable": false, |
541 | "config": { |
542 | @@ -15,24 +15,6 @@ |
543 | "plugin-collapse" |
544 | ] |
545 | } |
546 | - }, |
547 | - "navbar-autocomplete": { |
548 | - "jsfiles": [ |
549 | - "./js/navbar-autocomplete.js" |
550 | - ], |
551 | - "replace": { |
552 | - "@VERSION@": "0.0.1" |
553 | - }, |
554 | - "config": { |
555 | - "requires": [ |
556 | - "node", |
557 | - "autocomplete", |
558 | - "autocomplete-highlighters" |
559 | - ], |
560 | - "after": [ |
561 | - "navbar" |
562 | - ] |
563 | - } |
564 | } |
565 | } |
566 | } |
567 | |
568 | === removed file 'src/navbar/js/navbar-autocomplete.js' |
569 | --- src/navbar/js/navbar-autocomplete.js 2014-04-22 10:29:38 +0000 |
570 | +++ src/navbar/js/navbar-autocomplete.js 1970-01-01 00:00:00 +0000 |
571 | @@ -1,103 +0,0 @@ |
572 | -(function() { |
573 | - |
574 | -// store height of collapse once opened |
575 | -var baseCollapseHeight; |
576 | - |
577 | -// whever something happens with re: to the autocomplete, |
578 | -// we need to change the height of the collapse to match the |
579 | -// length of the list |
580 | -function afterAutoCompleteEvents (e, args) { |
581 | - |
582 | - // transition config of collapse |
583 | - var transitionConfig; |
584 | - // height of autocomplete list node |
585 | - var acListHeight; |
586 | - // collapse itself |
587 | - var collapse = args.collapse; |
588 | - // input which has autocomplete plugin |
589 | - var input = args.input; |
590 | - |
591 | - // only calculate new height if autocomplete collapse is expanded |
592 | - if(!collapse.get('state')) { |
593 | - return; |
594 | - } |
595 | - |
596 | - // would only happen if collapse did not open properly |
597 | - if(!baseCollapseHeight) { |
598 | - throw new Error('baseCollapseHeight was falsy or 0'); |
599 | - } |
600 | - |
601 | - // list was made invisible |
602 | - if(e.type === 'autocompleteListPlugin:visibleChange' && !e.newVal) { |
603 | - acListHeight = 0; |
604 | - } else { |
605 | - acListHeight = input.ac.get('listNode').get('scrollHeight'); |
606 | - } |
607 | - |
608 | - // config from collapse |
609 | - transitionConfig = collapse.getAttrs(['duration', 'easing']); |
610 | - // add height to config, using base value and the current autocomplete list node height |
611 | - transitionConfig.height = baseCollapseHeight + acListHeight + 'px'; |
612 | - |
613 | - // transition using created config |
614 | - collapse.get('host').transition(transitionConfig); |
615 | - |
616 | - Y.log('collapse host height: ' + transitionConfig.height, 'debug', 'navbar-autocomplete'); |
617 | -} |
618 | - |
619 | -var navbars = Y.all('.ues-navbar'); |
620 | - |
621 | -if (navbars.size()) { |
622 | - navbars.each(function(node, i) { |
623 | - |
624 | - // the autocomplete wrapper |
625 | - var wrapper = node.one('.autocomplete'); |
626 | - // input which has autocomplete plugin |
627 | - var input; |
628 | - // autocomplete boundingbox |
629 | - var autoCompleteBox; |
630 | - |
631 | - if(!wrapper) { |
632 | - Y.log('no AutoComplete wrapper in navbar #' + i, 'debug', 'navbar-autocomplete'); |
633 | - return; |
634 | - } |
635 | - |
636 | - input = wrapper.one('input[type="search"]'); |
637 | - if(!input) { |
638 | - throw new Error('autocomplete is missing input'); |
639 | - } |
640 | - |
641 | - // plug autocomplete |
642 | - input.plug(Y.Plugin.AutoComplete, { |
643 | - resultTextLocator: 'text', |
644 | - resultHighlighter: 'phraseMatch', |
645 | - tabSelect: true |
646 | - }); |
647 | - |
648 | - // whenever the autocomplete list node changes in height (or becomes invisible) |
649 | - // we need to change the height of the collapse |
650 | - input.ac.after(['clear', 'results', 'visibleChange'], afterAutoCompleteEvents, window, { |
651 | - collapse: wrapper.collapse, |
652 | - input: input |
653 | - }); |
654 | - |
655 | - // store collapse height the first time the collapse opens |
656 | - wrapper.collapse.once('open', function (e) { |
657 | - baseCollapseHeight = e.target.get('host').get('scrollHeight'); |
658 | - Y.log('baseCollapseHeight: ' + baseCollapseHeight, 'debug', 'navbar-autocomplete'); |
659 | - }); |
660 | - |
661 | - // add ues classes |
662 | - autoCompleteBox = input.ac.get('boundingBox'); |
663 | - autoCompleteBox.addClass('ues-autocomplete').addClass('ues-dropdown'); |
664 | - autoCompleteBox.one('ul').addClass('ues-dropdown-menu'); |
665 | - |
666 | - // make ac control the visibility of the ues-dropdown |
667 | - input.ac.before('visibleChange', function (e) { |
668 | - autoCompleteBox.toggleClass('open', e.newVal); |
669 | - }); |
670 | - |
671 | - }); |
672 | -} |
673 | - |
674 | -})(); |
675 | |
676 | === modified file 'src/navbar/js/navbar.js' |
677 | --- src/navbar/js/navbar.js 2014-04-16 13:48:47 +0000 |
678 | +++ src/navbar/js/navbar.js 2014-05-14 09:49:37 +0000 |
679 | @@ -35,41 +35,22 @@ |
680 | |
681 | var navbars = Y.all('.ues-navbar'); |
682 | |
683 | -if (navbars.size()) { |
684 | - navbars.each(function(node) { |
685 | - |
686 | - var header = node.one('.ues-navbar-header'); |
687 | - |
688 | - if(!header) { |
689 | - throw new Error('missing header dom'); |
690 | - } |
691 | - |
692 | - var menu = node.one('.ues-navbar-collapse:not(.search)'); |
693 | - var search = node.one('.ues-navbar-collapse.search'); |
694 | - |
695 | - if(menu) { |
696 | - var menuToggle = Y.Node.create('<div class="ues-icon-menu"></div>'); |
697 | - header.appendChild(menuToggle); |
698 | - Y.navbar.plugAndToggleSetupHelper(menu, menuToggle); |
699 | - } |
700 | - |
701 | - if(search) { |
702 | - var searchToggle = Y.Node.create('<div class="ues-icon-search-bordered"></div>'); |
703 | - header.appendChild(searchToggle); |
704 | - Y.navbar.plugAndToggleSetupHelper(search, searchToggle); |
705 | - } |
706 | - |
707 | - // if both menu and search, let one close the other on open |
708 | - if(menu && search) { |
709 | - Y.each([[menu, search], [search, menu]], function (n) { |
710 | - n[0].collapse.before('stateChange', function (e) { |
711 | - if(e.newVal) { |
712 | - n[1].collapse.close(); |
713 | - } |
714 | - }); |
715 | - }); |
716 | - } |
717 | - |
718 | - }); |
719 | -} |
720 | +navbars.each(function(node) { |
721 | + |
722 | + var header = node.one('.ues-navbar-header'); |
723 | + |
724 | + if(!header) { |
725 | + throw new Error('missing header dom'); |
726 | + } |
727 | + |
728 | + var menu = node.one('.ues-navbar-collapse'); |
729 | + |
730 | + if(menu) { |
731 | + var menuToggle = Y.Node.create('<div class="ues-icon-menu"></div>'); |
732 | + header.appendChild(menuToggle); |
733 | + Y.navbar.plugAndToggleSetupHelper(menu, menuToggle); |
734 | + } |
735 | + |
736 | +}); |
737 | + |
738 | })(); |
739 | |
740 | === modified file 'src/navbar/tests/manual/index.html' |
741 | --- src/navbar/tests/manual/index.html 2014-04-22 10:32:40 +0000 |
742 | +++ src/navbar/tests/manual/index.html 2014-05-14 09:49:37 +0000 |
743 | @@ -3,6 +3,7 @@ |
744 | <meta name="viewport" content="width=device-width, user-scalable=no"> |
745 | <title>navbar Manual Browser Tests / Sandbox</title> |
746 | <link rel="stylesheet" href="../../../../branches/ulysses/public/ulysses.css"> |
747 | +<link rel="stylesheet" media="(max-width: 480px)" href="../../../../branches/ulysses/public/navbar-small.css"> |
748 | <script src="../../../../bower_components/yui3/build/yui/yui-min.js"></script> |
749 | <script src="../../../../build/config.js"></script> |
750 | <script> |
751 | @@ -36,71 +37,14 @@ |
752 | </div> |
753 | <p>Hello world |
754 | |
755 | - |
756 | -<div class="ues-navbar" data-qa="navbar-search"> |
757 | - <div class="ues-navbar-header"> |
758 | - <div class="ues-navbar-brand"> |
759 | - <a href="/">[INSERT BRAND IMAGE OR TEXT]</a> |
760 | - </div> |
761 | - </div> |
762 | - <div class="ues-navbar-collapse collapse in"> |
763 | - <div class="ues-navbar-primary-nav"> |
764 | - <ul class="ues-navbar-menu"> |
765 | - <li><a href="">Dashboard</a></li> |
766 | - <li><a href="">Files</a></li> |
767 | - <li><a href="">Photos</a></li> |
768 | - <li><a href="">Music</a></li> |
769 | - </ul> |
770 | - </div> |
771 | - <ul class="ues-navbar-menu"> |
772 | - <li><a href="">Account</a></li> |
773 | - <li><a href="">Settings</a></li> |
774 | - <li><a href="">Logout</a></li> |
775 | - </ul> |
776 | - </div> |
777 | - <div class="ues-navbar-collapse search collapse in"> |
778 | - <div class="ues-navbar-secondary-nav"> |
779 | - <div class="ues-navbar-search"> |
780 | - <i class="ues-icon-search orange smaller"></i> |
781 | - <input class="ues-form-quicksearch" type="search" placeholder="Placeholder"> |
782 | - </div> |
783 | - </div> |
784 | - </div> |
785 | -</div> |
786 | - |
787 | -<p>Foo bar |
788 | - |
789 | -<div class="ues-navbar" data-qa="navbar-search-autocomplete"> |
790 | - <div class="ues-navbar-header"></div> |
791 | - <div class="ues-navbar-collapse search autocomplete collapse in"> |
792 | - <div class="ues-navbar-secondary-nav"> |
793 | - <div class="ues-navbar-search"> |
794 | - <i class="ues-icon-search orange smaller"></i> |
795 | - <input class="ues-form-quicksearch" type="search" placeholder="Placeholder"> |
796 | - </div> |
797 | - </div> |
798 | - </div> |
799 | -</div> |
800 | - |
801 | -<p>Bar baz |
802 | - |
803 | <script> |
804 | |
805 | -YUI().use('navbar', 'navbar-autocomplete', function(Y) { |
806 | +YUI().use('navbar', function(Y) { |
807 | var menu = Y.one('.ues-navbar-collapse'); |
808 | - var search = Y.one('.ues-navbar-collapse.search'); |
809 | |
810 | menu.collapse.on('collapse:stateChange', function(e) { |
811 | console.log('plugin {state} attr change event'); |
812 | }) |
813 | |
814 | - var ac = Y.one('.ues-navbar-collapse.autocomplete'); |
815 | - var acInput = ac.one('input[type="search"]'); |
816 | - |
817 | - acInput.ac.set('source', [ |
818 | - { text: 'Facebook' }, |
819 | - { text: 'Google' } |
820 | - ]); |
821 | - |
822 | }); |
823 | </script> |
824 | |
825 | === modified file 'src/navbar/tests/unit/js/tests.js' |
826 | --- src/navbar/tests/unit/js/tests.js 2014-04-22 09:28:30 +0000 |
827 | +++ src/navbar/tests/unit/js/tests.js 2014-05-14 09:49:37 +0000 |
828 | @@ -19,7 +19,7 @@ |
829 | }); |
830 | |
831 | after(function (done) { |
832 | - Y.all('.ues-icon-menu, .ues-icon-search-bordered').remove(true); |
833 | + Y.one('.ues-icon-menu').remove(true); |
834 | done(); |
835 | }); |
836 | |
837 | @@ -51,7 +51,7 @@ |
838 | }); |
839 | |
840 | after(function (done) { |
841 | - Y.all('.ues-icon-menu, .ues-icon-search-bordered').remove(true); |
842 | + Y.one('.ues-icon-menu').remove(true); |
843 | done(); |
844 | }); |
845 | |
846 | @@ -100,277 +100,6 @@ |
847 | expect(menu.hasClass('collapsing')).to.be.true; |
848 | }); |
849 | |
850 | - describe('search', function () { |
851 | - |
852 | - it('should have added a search icon', function () { |
853 | - expect(Y.one('[data-qa="navbar-search"] .ues-icon-search-bordered')).to.exist; |
854 | - }); |
855 | - |
856 | - it('should have a search form with collapse plugin plugged in', function () { |
857 | - var search = Y.one('[data-qa="navbar-search"] .ues-navbar-collapse.search'); |
858 | - expect(search.collapse).to.exist; |
859 | - }); |
860 | - |
861 | - it('should open search when search icon clicked', function (done) { |
862 | - var searchIcon = Y.one('[data-qa="navbar-search"] .ues-navbar-header > .ues-icon-search-bordered'); |
863 | - var search = Y.one('[data-qa="navbar-search"] .ues-navbar-collapse.search'); |
864 | - |
865 | - var event = search.collapse.on('stateChange', function (e, done) { |
866 | - expect(this.hasClass('in')).to.be.false; |
867 | - expect(this.hasClass('collapse')).to.be.true; |
868 | - expect(this.hasClass('collapsing')).to.be.false; |
869 | - |
870 | - event.detach(); |
871 | - done(); |
872 | - }, search, done); |
873 | - |
874 | - searchIcon.simulate('click'); |
875 | - // transition is 300ms, so this should immediately be true |
876 | - expect(search.hasClass('collapsing')).to.be.true; |
877 | - }); |
878 | - |
879 | - it('should close an open search when search icon clicked', function (done) { |
880 | - var searchIcon = Y.one('[data-qa="navbar-search"] .ues-navbar-header > .ues-icon-search-bordered'); |
881 | - var search = Y.one('[data-qa="navbar-search"] .ues-navbar-collapse.search'); |
882 | - |
883 | - var event = search.collapse.on('stateChange', function (e, done) { |
884 | - expect(this.hasClass('in')).to.be.true; |
885 | - expect(this.hasClass('collapse')).to.be.true; |
886 | - expect(this.hasClass('collapsing')).to.be.false; |
887 | - |
888 | - event.detach(); |
889 | - done(); |
890 | - }, search, done); |
891 | - |
892 | - searchIcon.simulate('click'); |
893 | - // transition is 300ms, so this should immediately be true |
894 | - expect(search.hasClass('collapsing')).to.be.true; |
895 | - }); |
896 | - |
897 | - }); |
898 | - |
899 | - describe('both search and menu together', function () { |
900 | - |
901 | - it('should open search', function (done) { |
902 | - var searchIcon = Y.one('[data-qa="navbar-search"] .ues-navbar-header > .ues-icon-search-bordered'); |
903 | - var search = Y.one('[data-qa="navbar-search"] .ues-navbar-collapse.search'); |
904 | - |
905 | - var event = search.collapse.on('stateChange', function (e, done) { |
906 | - event.detach(); |
907 | - done(); |
908 | - }, search, done); |
909 | - |
910 | - searchIcon.simulate('click'); |
911 | - |
912 | - }); |
913 | - |
914 | - it('should close an open search when menu icon clicked', function (done) { |
915 | - |
916 | - var hamburger = Y.one('[data-qa="navbar-search"] .ues-navbar-header > .ues-icon-menu'); |
917 | - var menu = Y.one('[data-qa="navbar-search"] .ues-navbar-collapse'); |
918 | - |
919 | - var search = Y.one('[data-qa="navbar-search"] .ues-navbar-collapse.search'); |
920 | - |
921 | - var menuEvent = menu.collapse.on('stateChange', function (e) { |
922 | - expect(this.hasClass('in')).to.be.false; |
923 | - expect(this.hasClass('collapse')).to.be.true; |
924 | - expect(this.hasClass('collapsing')).to.be.false; |
925 | - |
926 | - // this would start collapsing search |
927 | - expect(search.hasClass('collapsing')).to.be.true; |
928 | - |
929 | - menuEvent.detach(); |
930 | - |
931 | - }, menu); |
932 | - |
933 | - var searchEvent = search.collapse.on('stateChange', function (e, done) { |
934 | - expect(this.hasClass('in')).to.be.true; |
935 | - expect(this.hasClass('collapse')).to.be.true; |
936 | - expect(this.hasClass('collapsing')).to.be.false; |
937 | - |
938 | - searchEvent.detach(); |
939 | - done(); |
940 | - }, search, done); |
941 | - |
942 | - hamburger.simulate('click'); |
943 | - // transition is 300ms, so this should immediately be true |
944 | - expect(menu.hasClass('collapsing')).to.be.true; |
945 | - }); |
946 | - |
947 | - it('should close an open menu when search icon clicked', function (done) { |
948 | - |
949 | - var menu = Y.one('[data-qa="navbar-search"] .ues-navbar-collapse'); |
950 | - |
951 | - var search = Y.one('[data-qa="navbar-search"] .ues-navbar-collapse.search'); |
952 | - var searchIcon = Y.one('[data-qa="navbar-search"] .ues-navbar-header > .ues-icon-search-bordered'); |
953 | - |
954 | - var menuEvent = menu.collapse.on('stateChange', function (e) { |
955 | - expect(this.hasClass('in')).to.be.true; |
956 | - expect(this.hasClass('collapse')).to.be.true; |
957 | - expect(this.hasClass('collapsing')).to.be.false; |
958 | - |
959 | - |
960 | - menuEvent.detach(); |
961 | - done(); |
962 | - |
963 | - }, menu); |
964 | - |
965 | - var searchEvent = search.collapse.on('stateChange', function (e, done) { |
966 | - expect(this.hasClass('in')).to.be.false; |
967 | - expect(this.hasClass('collapse')).to.be.true; |
968 | - expect(this.hasClass('collapsing')).to.be.false; |
969 | - |
970 | - // this would start collapsing menu |
971 | - expect(menu.hasClass('collapsing')).to.be.true; |
972 | - |
973 | - searchEvent.detach(); |
974 | - }, search, done); |
975 | - |
976 | - searchIcon.simulate('click'); |
977 | - // transition is 300ms, so this should immediately be true |
978 | - expect(search.hasClass('collapsing')).to.be.true; |
979 | - }); |
980 | - |
981 | - }); |
982 | - |
983 | - }); |
984 | - |
985 | -})(); |
986 | - |
987 | -(function () { |
988 | - |
989 | - describe('navbar-autocomplete', function () { |
990 | - var Y, input; |
991 | - |
992 | - beforeEach(function (done) { |
993 | - Y = YUI().use( |
994 | - 'navbar', 'navbar-autocomplete', 'node-event-simulate', function (Y) { |
995 | - input = Y.one('.autocomplete input'); |
996 | - done(); |
997 | - }); |
998 | - }); |
999 | - |
1000 | - afterEach(function () { |
1001 | - |
1002 | - if(input.ac) { |
1003 | - input.ac.destroy(); |
1004 | - } |
1005 | - |
1006 | - Y.all('.ues-icon-menu, .ues-icon-search-bordered').remove(true); |
1007 | - |
1008 | - }); |
1009 | - |
1010 | - it('should plug autocomplete input node', function () { |
1011 | - Y.one('.autocomplete input').hasPlugin('ac'); |
1012 | - }); |
1013 | - |
1014 | - describe('autocollapse implementation tests', function () { |
1015 | - |
1016 | - var autoCompleteQuery = function () { |
1017 | - var val = 'face'; |
1018 | - |
1019 | - input.set('value', ''); |
1020 | - input.ac._onInputValueChange({newVal: ''}); |
1021 | - |
1022 | - input.set('value', val); |
1023 | - input.ac._onInputValueChange({newVal: val}); |
1024 | - }; |
1025 | - |
1026 | - var autoCompleteClear = function () { |
1027 | - var val = 'face'; |
1028 | - |
1029 | - input.set('value', val); |
1030 | - input.ac._onInputValueChange({newVal: val}); |
1031 | - |
1032 | - input.set('value', ''); |
1033 | - input.ac._onInputValueChange({newVal: ''}); |
1034 | - }; |
1035 | - |
1036 | - var wrapper; |
1037 | - |
1038 | - beforeEach(function (done) { |
1039 | - |
1040 | - wrapper = Y.one('.autocomplete'); |
1041 | - wrapper.collapse.set('duration', 0); |
1042 | - |
1043 | - var openEvent = wrapper.collapse.on('open', function (e, done) { |
1044 | - |
1045 | - done(); |
1046 | - openEvent.detach(); |
1047 | - |
1048 | - }, wrapper, done); |
1049 | - |
1050 | - wrapper.collapse.open(); |
1051 | - |
1052 | - }); |
1053 | - |
1054 | - it('should resize to fit input etc as well as autocomplete list on results', function (done) { |
1055 | - |
1056 | - input.ac.set('source', [ |
1057 | - { text: 'Facebook' }, |
1058 | - { text: 'Google+' } |
1059 | - ]); |
1060 | - |
1061 | - var baseHeight = wrapper.get('scrollHeight'); |
1062 | - |
1063 | - autoCompleteQuery(); |
1064 | - |
1065 | - var checkAutoComplete = function () { |
1066 | - var listNodeHeight = input.ac.get('listNode').get('scrollHeight'); |
1067 | - var wrapperHeight = wrapper.get('scrollHeight'); |
1068 | - var targetHeight = baseHeight + listNodeHeight; |
1069 | - |
1070 | - // estimates are good enough here |
1071 | - expect(wrapperHeight).to.be.within(targetHeight, targetHeight + 10); |
1072 | - done(); |
1073 | - }; |
1074 | - |
1075 | - // wait for autocomplete to act |
1076 | - window.setTimeout(checkAutoComplete, 100); |
1077 | - |
1078 | - }); |
1079 | - |
1080 | - it('should resize back to normal on clear', function (done) { |
1081 | - |
1082 | - input.ac.set('source', [ |
1083 | - { text: 'Facebook' }, |
1084 | - { text: 'Google+' } |
1085 | - ]); |
1086 | - |
1087 | - var baseHeight = wrapper.get('scrollHeight'); |
1088 | - |
1089 | - autoCompleteClear(); |
1090 | - |
1091 | - var checkAutoComplete = function () { |
1092 | - var wrapperHeight = wrapper.get('scrollHeight'); |
1093 | - |
1094 | - // estimates are good enough here |
1095 | - expect(wrapperHeight).to.be.within(baseHeight, baseHeight + 10); |
1096 | - done(); |
1097 | - }; |
1098 | - |
1099 | - // wait for autocomplete to act |
1100 | - window.setTimeout(checkAutoComplete, 100); |
1101 | - |
1102 | - }); |
1103 | - |
1104 | - }); |
1105 | - |
1106 | - }); |
1107 | - |
1108 | - describe('navbar-autocomplete (loaded disorderly)', function () { |
1109 | - |
1110 | - it('should not throw errors even if loaded before navbar', function () { |
1111 | - |
1112 | - var fun = function () { |
1113 | - YUI().use( |
1114 | - 'navbar-autocomplete', 'navbar', function (Y) { |
1115 | - }); |
1116 | - }; |
1117 | - |
1118 | - expect(fun).to.not.throw(/./); |
1119 | - }); |
1120 | - |
1121 | }); |
1122 | |
1123 | })(); |
1124 | |
1125 | === added directory 'src/searchbar' |
1126 | === added file 'src/searchbar/build.json' |
1127 | --- src/searchbar/build.json 1970-01-01 00:00:00 +0000 |
1128 | +++ src/searchbar/build.json 2014-05-14 09:49:37 +0000 |
1129 | @@ -0,0 +1,20 @@ |
1130 | +{ |
1131 | + "name": "searchbar", |
1132 | + "builds": { |
1133 | + "searchbar-autocomplete": { |
1134 | + "jsfiles": [ |
1135 | + "./js/searchbar-autocomplete.js" |
1136 | + ], |
1137 | + "replace": { |
1138 | + "@VERSION@": "0.1.0" |
1139 | + }, |
1140 | + "skinnable": false, |
1141 | + "config": { |
1142 | + "requires": [ |
1143 | + "node", |
1144 | + "autocomplete" |
1145 | + ] |
1146 | + } |
1147 | + } |
1148 | + } |
1149 | +} |
1150 | |
1151 | === added directory 'src/searchbar/js' |
1152 | === added file 'src/searchbar/js/searchbar-autocomplete.js' |
1153 | --- src/searchbar/js/searchbar-autocomplete.js 1970-01-01 00:00:00 +0000 |
1154 | +++ src/searchbar/js/searchbar-autocomplete.js 2014-05-14 09:49:37 +0000 |
1155 | @@ -0,0 +1,37 @@ |
1156 | +(function () { |
1157 | + |
1158 | +var searchbars = Y.all('.ues-searchbar'); |
1159 | + |
1160 | +searchbars.each(function (node, i) { |
1161 | + |
1162 | + // input which has autocomplete plugin |
1163 | + var input; |
1164 | + // autocomplete boundingbox |
1165 | + var autoCompleteBox; |
1166 | + |
1167 | + input = node.one('input[type="search"]'); |
1168 | + if (!input) { |
1169 | + throw new Error('autocomplete is missing input'); |
1170 | + } |
1171 | + |
1172 | + // plug autocomplete |
1173 | + input.plug(Y.Plugin.AutoComplete, { |
1174 | + resultTextLocator: 'text', |
1175 | + resultHighlighter: 'phraseMatch', |
1176 | + tabSelect: true |
1177 | + }); |
1178 | + |
1179 | + // add ues classes |
1180 | + autoCompleteBox = input.ac.get('boundingBox'); |
1181 | + autoCompleteBox.addClass('ues-autocomplete').addClass('ues-dropdown'); |
1182 | + autoCompleteBox.one('ul').addClass('ues-dropdown-menu'); |
1183 | + autoCompleteBox.setStyle('width', '100%'); |
1184 | + |
1185 | + // make ac control the visibility of the ues-dropdown |
1186 | + input.ac.before('visibleChange', function (e) { |
1187 | + autoCompleteBox.toggleClass('open', e.newVal); |
1188 | + }); |
1189 | + |
1190 | +}); |
1191 | + |
1192 | +})(); |
1193 | |
1194 | === added directory 'src/searchbar/tests' |
1195 | === added directory 'src/searchbar/tests/manual' |
1196 | === added file 'src/searchbar/tests/manual/index.html' |
1197 | --- src/searchbar/tests/manual/index.html 1970-01-01 00:00:00 +0000 |
1198 | +++ src/searchbar/tests/manual/index.html 2014-05-14 09:49:37 +0000 |
1199 | @@ -0,0 +1,33 @@ |
1200 | +<!doctype html> |
1201 | +<meta charset="utf-8" /> |
1202 | +<meta name="viewport" content="width=device-width, user-scalable=no"> |
1203 | +<title>searchbar Manual Browser Tests / Sandbox</title> |
1204 | +<link rel="stylesheet" href="../../../../branches/ulysses/public/ulysses.css"> |
1205 | +<link rel="stylesheet" media="(max-width: 480px)" href="../../../../branches/ulysses/public/searchbar-small.css"> |
1206 | +<script src="../../../../bower_components/yui3/build/yui/yui-min.js"></script> |
1207 | +<script src="../../../../build/config.js"></script> |
1208 | +<script> |
1209 | +YUI.GlobalConfig.groups.os.base = '../../../../build/'; |
1210 | +YUI.GlobalConfig.groups.os.filter = 'RAW'; |
1211 | +</script> |
1212 | + |
1213 | +<div id="searchbar" class="ues-searchbar" data-qa="searchbar-autocomplete"> |
1214 | + <div class="ues-searchbar-search"> |
1215 | + <i class="ues-icon-search orange smaller"></i> |
1216 | + <input class="ues-form-quicksearch" type="search" placeholder="Placeholder"> |
1217 | + </div> |
1218 | +</div> |
1219 | + |
1220 | +<script> |
1221 | + |
1222 | +YUI().use('searchbar-autocomplete', function(Y) { |
1223 | + |
1224 | + var autocomplete = Y.one('.ues-searchbar input'); |
1225 | + |
1226 | + autocomplete.ac.set('source', [ |
1227 | + { text: 'Facebook' }, |
1228 | + { text: 'Google' } |
1229 | + ]); |
1230 | + |
1231 | +}); |
1232 | +</script> |
1233 | |
1234 | === added directory 'src/searchbar/tests/unit' |
1235 | === added file 'src/searchbar/tests/unit/index.html' |
1236 | --- src/searchbar/tests/unit/index.html 1970-01-01 00:00:00 +0000 |
1237 | +++ src/searchbar/tests/unit/index.html 2014-05-14 09:49:37 +0000 |
1238 | @@ -0,0 +1,54 @@ |
1239 | +<!doctype html> |
1240 | +<meta charset="utf-8" /> |
1241 | +<title>searchbar Unit Tests</title> |
1242 | +<link rel="stylesheet" href="../../../../node_modules/mocha/mocha.css"> |
1243 | +<link rel="stylesheet" href="../../../../branches/ulysses/public/ulysses.css"> |
1244 | + |
1245 | +<body> |
1246 | + |
1247 | + |
1248 | + <div id="mocha"></div> |
1249 | +</body> |
1250 | + |
1251 | +<script src="../../../../bower_components/yui3/build/yui/yui-min.js"></script> |
1252 | +<script src="../../../../build/config.js"></script> |
1253 | +<script> |
1254 | + YUI.GlobalConfig.groups.os.base = '../../../../build/'; |
1255 | + YUI.GlobalConfig.groups.os.filter = 'debug'; |
1256 | +</script> |
1257 | + |
1258 | +<script src="../../../../node_modules/mocha/mocha.js"></script> |
1259 | +<script src="../../../../node_modules/chai/chai.js"></script> |
1260 | + |
1261 | +<div id="searchbar" class="ues-searchbar" data-qa="searchbar-autocomplete"> |
1262 | + <div class="ues-searchbar-search"> |
1263 | + <i class="ues-icon-search orange smaller"></i> |
1264 | + <input class="ues-form-quicksearch" type="search" placeholder="Placeholder"> |
1265 | + </div> |
1266 | +</div> |
1267 | + |
1268 | + |
1269 | +<script> |
1270 | + var assert = chai.assert; |
1271 | + var expect = chai.expect; |
1272 | + var should = chai.should(); |
1273 | + |
1274 | + mocha.reporter('html'); |
1275 | + mocha.ui('bdd'); |
1276 | + mocha.setup({ |
1277 | + ignoreLeaks: false, |
1278 | + timeout: 10000, |
1279 | + globals: ['_yuid'] |
1280 | + }); |
1281 | +</script> |
1282 | +<script src="js/tests.js"></script> |
1283 | +<script> |
1284 | +YUI().use('node', function(Y) { |
1285 | + if (window.mochaPhantomJS) { |
1286 | + mochaPhantomJS.run(); |
1287 | + } else { |
1288 | + mocha.run(); |
1289 | + } |
1290 | + }); |
1291 | +</script> |
1292 | + |
1293 | |
1294 | === added directory 'src/searchbar/tests/unit/js' |
1295 | === added file 'src/searchbar/tests/unit/js/tests.js' |
1296 | --- src/searchbar/tests/unit/js/tests.js 1970-01-01 00:00:00 +0000 |
1297 | +++ src/searchbar/tests/unit/js/tests.js 2014-05-14 09:49:37 +0000 |
1298 | @@ -0,0 +1,104 @@ |
1299 | +'use strict'; |
1300 | + |
1301 | +(function () { |
1302 | + |
1303 | + describe('searchbar-autocomplete', function () { |
1304 | + var Y, input; |
1305 | + |
1306 | + beforeEach(function (done) { |
1307 | + Y = YUI().use( |
1308 | + 'searchbar-autocomplete', function (Y) { |
1309 | + input = Y.one('.ues-searchbar input'); |
1310 | + done(); |
1311 | + }); |
1312 | + }); |
1313 | + |
1314 | + afterEach(function () { |
1315 | + |
1316 | + if(input.ac) { |
1317 | + input.ac.destroy(); |
1318 | + } |
1319 | + |
1320 | + }); |
1321 | + |
1322 | + it('should plug autocomplete input node', function () { |
1323 | + expect(input.hasPlugin('ac')).to.be.ok; |
1324 | + }); |
1325 | + |
1326 | + describe('autocollapse implementation tests', function () { |
1327 | + |
1328 | + it('should add css class to boundingBox', function () { |
1329 | + var bBox = input.ac.get('boundingBox'); |
1330 | + expect(bBox.hasClass('ues-autocomplete')).to.be.true; |
1331 | + expect(bBox.hasClass('ues-dropdown')).to.be.true; |
1332 | + }); |
1333 | + |
1334 | + it('should monkey patch width style for boundingBox', function () { |
1335 | + var bBox = input.ac.get('boundingBox'); |
1336 | + expect(bBox.getStyle('width')).to.eql('100%'); |
1337 | + }); |
1338 | + |
1339 | + it('should toggle open class on ac.visibleChange', function (done) { |
1340 | + |
1341 | + var bBox = input.ac.get('boundingBox'); |
1342 | + |
1343 | + input.ac.after('visibleChange', function (e) { |
1344 | + |
1345 | + expect(bBox.hasClass('open')).to.eql(e.newVal); |
1346 | + |
1347 | + if(e.callDone) { |
1348 | + done(); |
1349 | + } |
1350 | + |
1351 | + }); |
1352 | + |
1353 | + input.ac.set('visible', false); |
1354 | + input.ac.set('visible', true); |
1355 | + input.ac.set('visible', false, { |
1356 | + callDone: true |
1357 | + }); |
1358 | + |
1359 | + }); |
1360 | + |
1361 | + }); |
1362 | + |
1363 | + }); |
1364 | + |
1365 | + |
1366 | + describe('searchbar-autocomplete (loaded with bad dom)', function () { |
1367 | + |
1368 | + var input; |
1369 | + |
1370 | + // remove input node |
1371 | + before(function (done) { |
1372 | + YUI().use('node', function (Y) { |
1373 | + var i = Y.one('.ues-searchbar input'); |
1374 | + input = i; |
1375 | + i.remove(); |
1376 | + done(); |
1377 | + }); |
1378 | + }); |
1379 | + |
1380 | + // reinstate input node |
1381 | + after(function (done) { |
1382 | + YUI().use('node', function (Y) { |
1383 | + Y.one('.ues-searchbar').append(input); |
1384 | + done(); |
1385 | + }); |
1386 | + }); |
1387 | + |
1388 | + |
1389 | + it('should throw errors if used without proper DOM', function () { |
1390 | + |
1391 | + var fun = function () { |
1392 | + YUI().use( |
1393 | + 'searchbar-autocomplete', function (Y) { |
1394 | + }); |
1395 | + }; |
1396 | + |
1397 | + expect(fun).to.throw('autocomplete is missing input'); |
1398 | + }); |
1399 | + |
1400 | + }); |
1401 | + |
1402 | +})(); |
ln: 1084 I've done this in a few places myself but Y.all returns a NodeList even if the query result is empty, in which case Y.Array.each is noop, therefore checking the size of searchbars NodeList is wasteful, I think. http:// jsfiddle. net/earnubs/ Xkb93/
ln: 1095 space after if keyword
ln: 1204 if you add _yuid to mocha's globals whitelist unit tests will pass in the browser too (this is something needs done to all the tests in the lib I think)
mocha.setup({
ignoreLeaks: false,
timeout: 10000,
globals: ['_yuid']
});