3 Copyright 2012 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
7 if (typeof _yuitest_coverage == "undefined"){
8 _yuitest_coverage = {};
9 _yuitest_coverline = function(src, line){
10 var coverage = _yuitest_coverage[src];
11 if (!coverage.lines[line]){
12 coverage.calledLines++;
14 coverage.lines[line]++;
16 _yuitest_coverfunc = function(src, name, line){
17 var coverage = _yuitest_coverage[src],
18 funcId = name + ":" + line;
19 if (!coverage.functions[funcId]){
20 coverage.calledFunctions++;
22 coverage.functions[funcId]++;
25 _yuitest_coverage["build/tabview/tabview.js"] = {
32 path: "build/tabview/tabview.js",
35 _yuitest_coverage["build/tabview/tabview.js"].code=["YUI.add('tabview', function (Y, NAME) {","","/**"," * The TabView module "," *"," * @module tabview"," */","","var _queries = Y.TabviewBase._queries,"," _classNames = Y.TabviewBase._classNames,"," DOT = '.',"," getClassName = Y.ClassNameManager.getClassName,",""," /**"," * Provides a tabbed widget interface "," * @param config {Object} Object literal specifying tabview configuration properties."," *"," * @class TabView"," * @constructor"," * @extends Widget"," * @uses WidgetParent"," */"," TabView = Y.Base.create('tabView', Y.Widget, [Y.WidgetParent], {"," _afterChildAdded: function(e) {"," this.get('contentBox').focusManager.refresh();"," },",""," _defListNodeValueFn: function() {"," return Y.Node.create(TabView.LIST_TEMPLATE);"," },",""," _defPanelNodeValueFn: function() {"," return Y.Node.create(TabView.PANEL_TEMPLATE);"," },",""," _afterChildRemoved: function(e) { // update the selected tab when removed"," var i = e.index,"," selection = this.get('selection');",""," if (!selection) { // select previous item if selection removed"," selection = this.item(i - 1) || this.item(0);"," if (selection) {"," selection.set('selected', 1);"," }"," }",""," this.get('contentBox').focusManager.refresh();"," },",""," _initAria: function() {"," var contentBox = this.get('contentBox'),"," tablist = contentBox.one(_queries.tabviewList);",""," if (tablist) {"," tablist.setAttrs({"," //'aria-labelledby': "," role: 'tablist'"," });"," }"," },",""," bindUI: function() {"," // Use the Node Focus Manager to add keyboard support:"," // Pressing the left and right arrow keys will move focus"," // among each of the tabs.",""," this.get('contentBox').plug(Y.Plugin.NodeFocusManager, {"," descendants: DOT + _classNames.tabLabel,"," keys: { next: 'down:39', // Right arrow"," previous: 'down:37' }, // Left arrow"," circular: true"," });",""," this.after('render', this._setDefSelection);"," this.after('addChild', this._afterChildAdded);"," this.after('removeChild', this._afterChildRemoved);"," },"," "," renderUI: function() {"," var contentBox = this.get('contentBox'); "," this._renderListBox(contentBox);"," this._renderPanelBox(contentBox);"," this._childrenContainer = this.get('listNode');"," this._renderTabs(contentBox);"," },",""," _setDefSelection: function(contentBox) {"," // If no tab is selected, select the first tab."," var selection = this.get('selection') || this.item(0);",""," this.some(function(tab) {"," if (tab.get('selected')) {"," selection = tab;"," return true;"," }"," });"," if (selection) {"," // TODO: why both needed? (via widgetParent/Child)?"," this.set('selection', selection);"," selection.set('selected', 1);"," }"," },",""," _renderListBox: function(contentBox) {"," var node = this.get('listNode');"," if (!node.inDoc()) {"," contentBox.append(node);"," }"," },",""," _renderPanelBox: function(contentBox) {"," var node = this.get('panelNode');"," if (!node.inDoc()) {"," contentBox.append(node);"," }"," },",""," _renderTabs: function(contentBox) {"," var tabs = contentBox.all(_queries.tab),"," panelNode = this.get('panelNode'),"," panels = (panelNode) ? this.get('panelNode').get('children') : null,"," tabview = this;",""," if (tabs) { // add classNames and fill in Tab fields from markup when possible"," tabs.addClass(_classNames.tab);"," contentBox.all(_queries.tabLabel).addClass(_classNames.tabLabel);"," contentBox.all(_queries.tabPanel).addClass(_classNames.tabPanel);",""," tabs.each(function(node, i) {"," var panelNode = (panels) ? panels.item(i) : null;"," tabview.add({"," boundingBox: node,"," contentBox: node.one(DOT + _classNames.tabLabel),"," label: node.one(DOT + _classNames.tabLabel).get('text'),"," panelNode: panelNode"," });"," });"," }"," }","}, {",""," LIST_TEMPLATE: '<ul class=\"' + _classNames.tabviewList + '\"></ul>',"," PANEL_TEMPLATE: '<div class=\"' + _classNames.tabviewPanel + '\"></div>',",""," ATTRS: {"," defaultChildType: { "," value: 'Tab'"," },",""," listNode: {"," setter: function(node) {"," node = Y.one(node);"," if (node) {"," node.addClass(_classNames.tabviewList);"," }"," return node;"," },",""," valueFn: '_defListNodeValueFn'"," },",""," panelNode: {"," setter: function(node) {"," node = Y.one(node);"," if (node) {"," node.addClass(_classNames.tabviewPanel);"," }"," return node;"," },",""," valueFn: '_defPanelNodeValueFn'"," },",""," tabIndex: {"," value: null"," //validator: '_validTabIndex'"," }"," },",""," HTML_PARSER: {"," listNode: _queries.tabviewList,"," panelNode: _queries.tabviewPanel"," }","});","","Y.TabView = TabView;","var Lang = Y.Lang,"," _queries = Y.TabviewBase._queries,"," _classNames = Y.TabviewBase._classNames,"," getClassName = Y.ClassNameManager.getClassName;","","/**"," * Provides Tab instances for use with TabView"," * @param config {Object} Object literal specifying tabview configuration properties."," *"," * @class Tab"," * @constructor"," * @extends Widget"," * @uses WidgetChild"," */","Y.Tab = Y.Base.create('tab', Y.Widget, [Y.WidgetChild], {"," BOUNDING_TEMPLATE: '<li class=\"' + _classNames.tab + '\"></li>',"," CONTENT_TEMPLATE: '<a class=\"' + _classNames.tabLabel + '\"></a>',"," PANEL_TEMPLATE: '<div class=\"' + _classNames.tabPanel + '\"></div>',",""," _uiSetSelectedPanel: function(selected) {"," this.get('panelNode').toggleClass(_classNames.selectedPanel, selected);"," },",""," _afterTabSelectedChange: function(event) {"," this._uiSetSelectedPanel(event.newVal);"," },",""," _afterParentChange: function(e) {"," if (!e.newVal) {"," this._remove();"," } else {"," this._add();"," }"," },",""," _initAria: function() {"," var anchor = this.get('contentBox'),"," id = anchor.get('id'),"," panel = this.get('panelNode');"," "," if (!id) {"," id = Y.guid();"," anchor.set('id', id);"," }"," // Apply the ARIA roles, states and properties to each tab"," anchor.set('role', 'tab');"," anchor.get('parentNode').set('role', 'presentation');"," "," "," // Apply the ARIA roles, states and properties to each panel"," panel.setAttrs({"," role: 'tabpanel',"," 'aria-labelledby': id"," });"," },",""," syncUI: function() {"," this.set('label', this.get('label'));"," this.set('content', this.get('content'));"," this._uiSetSelectedPanel(this.get('selected'));"," },",""," bindUI: function() {"," this.after('selectedChange', this._afterTabSelectedChange);"," this.after('parentChange', this._afterParentChange);"," },",""," renderUI: function() {"," this._renderPanel();"," this._initAria();"," },",""," _renderPanel: function() {"," this.get('parent').get('panelNode')"," .appendChild(this.get('panelNode'));"," },",""," _add: function() {"," var parent = this.get('parent').get('contentBox'),"," list = parent.get('listNode'),"," panel = parent.get('panelNode');",""," if (list) {"," list.appendChild(this.get('boundingBox'));"," }",""," if (panel) {"," panel.appendChild(this.get('panelNode'));"," }"," },"," "," _remove: function() {"," this.get('boundingBox').remove();"," this.get('panelNode').remove();"," },",""," _onActivate: function(e) {"," if (e.target === this) {"," // Prevent the browser from navigating to the URL specified by the "," // anchor's href attribute."," e.domEvent.preventDefault();"," e.target.set('selected', 1);"," }"," },"," "," initializer: function() {"," this.publish(this.get('triggerEvent'), { "," defaultFn: this._onActivate"," });"," },",""," _defLabelSetter: function(label) {"," this.get('contentBox').setContent(label);"," return label;"," },",""," _defContentSetter: function(content) {"," this.get('panelNode').setContent(content);"," return content;"," },",""," _defContentGetter: function(content) {"," return this.get('panelNode').getContent();"," },",""," // find panel by ID mapping from label href"," _defPanelNodeValueFn: function() {"," var href = this.get('contentBox').get('href') || '',"," parent = this.get('parent'),"," hashIndex = href.indexOf('#'),"," panel;",""," href = href.substr(hashIndex);",""," if (href.charAt(0) === '#') { // in-page nav, find by ID"," panel = Y.one(href);"," if (panel) {"," panel.addClass(_classNames.tabPanel);"," }"," }",""," // use the one found by id, or else try matching indices"," if (!panel && parent) {"," panel = parent.get('panelNode')"," .get('children').item(this.get('index'));"," }",""," if (!panel) { // create if none found"," panel = Y.Node.create(this.PANEL_TEMPLATE);"," }"," return panel;"," }","}, {"," ATTRS: {"," /**"," * @attribute triggerEvent"," * @default \"click\" "," * @type String"," */"," triggerEvent: {"," value: 'click'"," },",""," /**"," * @attribute label"," * @type HTML"," */"," label: { "," setter: '_defLabelSetter',"," validator: Lang.isString"," },",""," /**"," * @attribute content"," * @type HTML"," */"," content: {"," setter: '_defContentSetter',"," getter: '_defContentGetter'"," },",""," /**"," * @attribute panelNode"," * @type Y.Node"," */"," panelNode: {"," setter: function(node) {"," node = Y.one(node);"," if (node) {"," node.addClass(_classNames.tabPanel);"," }"," return node;"," },"," valueFn: '_defPanelNodeValueFn'"," },"," "," tabIndex: {"," value: null,"," validator: '_validTabIndex'"," } ",""," },",""," HTML_PARSER: {"," selected: function(contentBox) {"," var ret = (this.get('boundingBox').hasClass(_classNames.selectedTab)) ?"," 1 : 0;"," return ret;"," }"," }","","});","","","}, '3.7.2', {\"requires\": [\"widget\", \"widget-parent\", \"widget-child\", \"tabview-base\", \"node-pluginhost\", \"node-focusmanager\"], \"skinnable\": true});"];
36 _yuitest_coverage["build/tabview/tabview.js"].lines = {"1":0,"9":0,"25":0,"29":0,"33":0,"37":0,"40":0,"41":0,"42":0,"43":0,"47":0,"51":0,"54":0,"55":0,"67":0,"74":0,"75":0,"76":0,"80":0,"81":0,"82":0,"83":0,"84":0,"89":0,"91":0,"92":0,"93":0,"94":0,"97":0,"99":0,"100":0,"105":0,"106":0,"107":0,"112":0,"113":0,"114":0,"119":0,"124":0,"125":0,"126":0,"127":0,"129":0,"130":0,"131":0,"152":0,"153":0,"154":0,"156":0,"164":0,"165":0,"166":0,"168":0,"186":0,"187":0,"201":0,"207":0,"211":0,"215":0,"216":0,"218":0,"223":0,"227":0,"228":0,"229":0,"232":0,"233":0,"237":0,"244":0,"245":0,"246":0,"250":0,"251":0,"255":0,"256":0,"260":0,"265":0,"269":0,"270":0,"273":0,"274":0,"279":0,"280":0,"284":0,"287":0,"288":0,"293":0,"299":0,"300":0,"304":0,"305":0,"309":0,"314":0,"319":0,"321":0,"322":0,"323":0,"324":0,"329":0,"330":0,"334":0,"335":0,"337":0,"374":0,"375":0,"376":0,"378":0,"392":0,"394":0};
37 _yuitest_coverage["build/tabview/tabview.js"].functions = {"_afterChildAdded:24":0,"_defListNodeValueFn:28":0,"_defPanelNodeValueFn:32":0,"_afterChildRemoved:36":0,"_initAria:50":0,"bindUI:62":0,"renderUI:79":0,"(anonymous 2):91":0,"_setDefSelection:87":0,"_renderListBox:104":0,"_renderPanelBox:111":0,"(anonymous 3):129":0,"_renderTabs:118":0,"setter:151":0,"setter:163":0,"_uiSetSelectedPanel:206":0,"_afterTabSelectedChange:210":0,"_afterParentChange:214":0,"_initAria:222":0,"syncUI:243":0,"bindUI:249":0,"renderUI:254":0,"_renderPanel:259":0,"_add:264":0,"_remove:278":0,"_onActivate:283":0,"initializer:292":0,"_defLabelSetter:298":0,"_defContentSetter:303":0,"_defContentGetter:308":0,"_defPanelNodeValueFn:313":0,"setter:373":0,"selected:391":0,"(anonymous 1):1":0};
38 _yuitest_coverage["build/tabview/tabview.js"].coveredLines = 109;
39 _yuitest_coverage["build/tabview/tabview.js"].coveredFunctions = 34;
40 _yuitest_coverline("build/tabview/tabview.js", 1);
41 YUI.add('tabview', function (Y, NAME) {
49 _yuitest_coverfunc("build/tabview/tabview.js", "(anonymous 1)", 1);
50 _yuitest_coverline("build/tabview/tabview.js", 9);
51 var _queries = Y.TabviewBase._queries,
52 _classNames = Y.TabviewBase._classNames,
54 getClassName = Y.ClassNameManager.getClassName,
57 * Provides a tabbed widget interface
58 * @param config {Object} Object literal specifying tabview configuration properties.
65 TabView = Y.Base.create('tabView', Y.Widget, [Y.WidgetParent], {
66 _afterChildAdded: function(e) {
67 _yuitest_coverfunc("build/tabview/tabview.js", "_afterChildAdded", 24);
68 _yuitest_coverline("build/tabview/tabview.js", 25);
69 this.get('contentBox').focusManager.refresh();
72 _defListNodeValueFn: function() {
73 _yuitest_coverfunc("build/tabview/tabview.js", "_defListNodeValueFn", 28);
74 _yuitest_coverline("build/tabview/tabview.js", 29);
75 return Y.Node.create(TabView.LIST_TEMPLATE);
78 _defPanelNodeValueFn: function() {
79 _yuitest_coverfunc("build/tabview/tabview.js", "_defPanelNodeValueFn", 32);
80 _yuitest_coverline("build/tabview/tabview.js", 33);
81 return Y.Node.create(TabView.PANEL_TEMPLATE);
84 _afterChildRemoved: function(e) { // update the selected tab when removed
85 _yuitest_coverfunc("build/tabview/tabview.js", "_afterChildRemoved", 36);
86 _yuitest_coverline("build/tabview/tabview.js", 37);
88 selection = this.get('selection');
90 _yuitest_coverline("build/tabview/tabview.js", 40);
91 if (!selection) { // select previous item if selection removed
92 _yuitest_coverline("build/tabview/tabview.js", 41);
93 selection = this.item(i - 1) || this.item(0);
94 _yuitest_coverline("build/tabview/tabview.js", 42);
96 _yuitest_coverline("build/tabview/tabview.js", 43);
97 selection.set('selected', 1);
101 _yuitest_coverline("build/tabview/tabview.js", 47);
102 this.get('contentBox').focusManager.refresh();
105 _initAria: function() {
106 _yuitest_coverfunc("build/tabview/tabview.js", "_initAria", 50);
107 _yuitest_coverline("build/tabview/tabview.js", 51);
108 var contentBox = this.get('contentBox'),
109 tablist = contentBox.one(_queries.tabviewList);
111 _yuitest_coverline("build/tabview/tabview.js", 54);
113 _yuitest_coverline("build/tabview/tabview.js", 55);
122 // Use the Node Focus Manager to add keyboard support:
123 // Pressing the left and right arrow keys will move focus
124 // among each of the tabs.
126 _yuitest_coverfunc("build/tabview/tabview.js", "bindUI", 62);
127 _yuitest_coverline("build/tabview/tabview.js", 67);
128 this.get('contentBox').plug(Y.Plugin.NodeFocusManager, {
129 descendants: DOT + _classNames.tabLabel,
130 keys: { next: 'down:39', // Right arrow
131 previous: 'down:37' }, // Left arrow
135 _yuitest_coverline("build/tabview/tabview.js", 74);
136 this.after('render', this._setDefSelection);
137 _yuitest_coverline("build/tabview/tabview.js", 75);
138 this.after('addChild', this._afterChildAdded);
139 _yuitest_coverline("build/tabview/tabview.js", 76);
140 this.after('removeChild', this._afterChildRemoved);
143 renderUI: function() {
144 _yuitest_coverfunc("build/tabview/tabview.js", "renderUI", 79);
145 _yuitest_coverline("build/tabview/tabview.js", 80);
146 var contentBox = this.get('contentBox');
147 _yuitest_coverline("build/tabview/tabview.js", 81);
148 this._renderListBox(contentBox);
149 _yuitest_coverline("build/tabview/tabview.js", 82);
150 this._renderPanelBox(contentBox);
151 _yuitest_coverline("build/tabview/tabview.js", 83);
152 this._childrenContainer = this.get('listNode');
153 _yuitest_coverline("build/tabview/tabview.js", 84);
154 this._renderTabs(contentBox);
157 _setDefSelection: function(contentBox) {
158 // If no tab is selected, select the first tab.
159 _yuitest_coverfunc("build/tabview/tabview.js", "_setDefSelection", 87);
160 _yuitest_coverline("build/tabview/tabview.js", 89);
161 var selection = this.get('selection') || this.item(0);
163 _yuitest_coverline("build/tabview/tabview.js", 91);
164 this.some(function(tab) {
165 _yuitest_coverfunc("build/tabview/tabview.js", "(anonymous 2)", 91);
166 _yuitest_coverline("build/tabview/tabview.js", 92);
167 if (tab.get('selected')) {
168 _yuitest_coverline("build/tabview/tabview.js", 93);
170 _yuitest_coverline("build/tabview/tabview.js", 94);
174 _yuitest_coverline("build/tabview/tabview.js", 97);
176 // TODO: why both needed? (via widgetParent/Child)?
177 _yuitest_coverline("build/tabview/tabview.js", 99);
178 this.set('selection', selection);
179 _yuitest_coverline("build/tabview/tabview.js", 100);
180 selection.set('selected', 1);
184 _renderListBox: function(contentBox) {
185 _yuitest_coverfunc("build/tabview/tabview.js", "_renderListBox", 104);
186 _yuitest_coverline("build/tabview/tabview.js", 105);
187 var node = this.get('listNode');
188 _yuitest_coverline("build/tabview/tabview.js", 106);
190 _yuitest_coverline("build/tabview/tabview.js", 107);
191 contentBox.append(node);
195 _renderPanelBox: function(contentBox) {
196 _yuitest_coverfunc("build/tabview/tabview.js", "_renderPanelBox", 111);
197 _yuitest_coverline("build/tabview/tabview.js", 112);
198 var node = this.get('panelNode');
199 _yuitest_coverline("build/tabview/tabview.js", 113);
201 _yuitest_coverline("build/tabview/tabview.js", 114);
202 contentBox.append(node);
206 _renderTabs: function(contentBox) {
207 _yuitest_coverfunc("build/tabview/tabview.js", "_renderTabs", 118);
208 _yuitest_coverline("build/tabview/tabview.js", 119);
209 var tabs = contentBox.all(_queries.tab),
210 panelNode = this.get('panelNode'),
211 panels = (panelNode) ? this.get('panelNode').get('children') : null,
214 _yuitest_coverline("build/tabview/tabview.js", 124);
215 if (tabs) { // add classNames and fill in Tab fields from markup when possible
216 _yuitest_coverline("build/tabview/tabview.js", 125);
217 tabs.addClass(_classNames.tab);
218 _yuitest_coverline("build/tabview/tabview.js", 126);
219 contentBox.all(_queries.tabLabel).addClass(_classNames.tabLabel);
220 _yuitest_coverline("build/tabview/tabview.js", 127);
221 contentBox.all(_queries.tabPanel).addClass(_classNames.tabPanel);
223 _yuitest_coverline("build/tabview/tabview.js", 129);
224 tabs.each(function(node, i) {
225 _yuitest_coverfunc("build/tabview/tabview.js", "(anonymous 3)", 129);
226 _yuitest_coverline("build/tabview/tabview.js", 130);
227 var panelNode = (panels) ? panels.item(i) : null;
228 _yuitest_coverline("build/tabview/tabview.js", 131);
231 contentBox: node.one(DOT + _classNames.tabLabel),
232 label: node.one(DOT + _classNames.tabLabel).get('text'),
240 LIST_TEMPLATE: '<ul class="' + _classNames.tabviewList + '"></ul>',
241 PANEL_TEMPLATE: '<div class="' + _classNames.tabviewPanel + '"></div>',
249 setter: function(node) {
250 _yuitest_coverfunc("build/tabview/tabview.js", "setter", 151);
251 _yuitest_coverline("build/tabview/tabview.js", 152);
253 _yuitest_coverline("build/tabview/tabview.js", 153);
255 _yuitest_coverline("build/tabview/tabview.js", 154);
256 node.addClass(_classNames.tabviewList);
258 _yuitest_coverline("build/tabview/tabview.js", 156);
262 valueFn: '_defListNodeValueFn'
266 setter: function(node) {
267 _yuitest_coverfunc("build/tabview/tabview.js", "setter", 163);
268 _yuitest_coverline("build/tabview/tabview.js", 164);
270 _yuitest_coverline("build/tabview/tabview.js", 165);
272 _yuitest_coverline("build/tabview/tabview.js", 166);
273 node.addClass(_classNames.tabviewPanel);
275 _yuitest_coverline("build/tabview/tabview.js", 168);
279 valueFn: '_defPanelNodeValueFn'
284 //validator: '_validTabIndex'
289 listNode: _queries.tabviewList,
290 panelNode: _queries.tabviewPanel
294 _yuitest_coverline("build/tabview/tabview.js", 186);
296 _yuitest_coverline("build/tabview/tabview.js", 187);
298 _queries = Y.TabviewBase._queries,
299 _classNames = Y.TabviewBase._classNames,
300 getClassName = Y.ClassNameManager.getClassName;
303 * Provides Tab instances for use with TabView
304 * @param config {Object} Object literal specifying tabview configuration properties.
311 _yuitest_coverline("build/tabview/tabview.js", 201);
312 Y.Tab = Y.Base.create('tab', Y.Widget, [Y.WidgetChild], {
313 BOUNDING_TEMPLATE: '<li class="' + _classNames.tab + '"></li>',
314 CONTENT_TEMPLATE: '<a class="' + _classNames.tabLabel + '"></a>',
315 PANEL_TEMPLATE: '<div class="' + _classNames.tabPanel + '"></div>',
317 _uiSetSelectedPanel: function(selected) {
318 _yuitest_coverfunc("build/tabview/tabview.js", "_uiSetSelectedPanel", 206);
319 _yuitest_coverline("build/tabview/tabview.js", 207);
320 this.get('panelNode').toggleClass(_classNames.selectedPanel, selected);
323 _afterTabSelectedChange: function(event) {
324 _yuitest_coverfunc("build/tabview/tabview.js", "_afterTabSelectedChange", 210);
325 _yuitest_coverline("build/tabview/tabview.js", 211);
326 this._uiSetSelectedPanel(event.newVal);
329 _afterParentChange: function(e) {
330 _yuitest_coverfunc("build/tabview/tabview.js", "_afterParentChange", 214);
331 _yuitest_coverline("build/tabview/tabview.js", 215);
333 _yuitest_coverline("build/tabview/tabview.js", 216);
336 _yuitest_coverline("build/tabview/tabview.js", 218);
341 _initAria: function() {
342 _yuitest_coverfunc("build/tabview/tabview.js", "_initAria", 222);
343 _yuitest_coverline("build/tabview/tabview.js", 223);
344 var anchor = this.get('contentBox'),
345 id = anchor.get('id'),
346 panel = this.get('panelNode');
348 _yuitest_coverline("build/tabview/tabview.js", 227);
350 _yuitest_coverline("build/tabview/tabview.js", 228);
352 _yuitest_coverline("build/tabview/tabview.js", 229);
353 anchor.set('id', id);
355 // Apply the ARIA roles, states and properties to each tab
356 _yuitest_coverline("build/tabview/tabview.js", 232);
357 anchor.set('role', 'tab');
358 _yuitest_coverline("build/tabview/tabview.js", 233);
359 anchor.get('parentNode').set('role', 'presentation');
362 // Apply the ARIA roles, states and properties to each panel
363 _yuitest_coverline("build/tabview/tabview.js", 237);
366 'aria-labelledby': id
371 _yuitest_coverfunc("build/tabview/tabview.js", "syncUI", 243);
372 _yuitest_coverline("build/tabview/tabview.js", 244);
373 this.set('label', this.get('label'));
374 _yuitest_coverline("build/tabview/tabview.js", 245);
375 this.set('content', this.get('content'));
376 _yuitest_coverline("build/tabview/tabview.js", 246);
377 this._uiSetSelectedPanel(this.get('selected'));
381 _yuitest_coverfunc("build/tabview/tabview.js", "bindUI", 249);
382 _yuitest_coverline("build/tabview/tabview.js", 250);
383 this.after('selectedChange', this._afterTabSelectedChange);
384 _yuitest_coverline("build/tabview/tabview.js", 251);
385 this.after('parentChange', this._afterParentChange);
388 renderUI: function() {
389 _yuitest_coverfunc("build/tabview/tabview.js", "renderUI", 254);
390 _yuitest_coverline("build/tabview/tabview.js", 255);
392 _yuitest_coverline("build/tabview/tabview.js", 256);
396 _renderPanel: function() {
397 _yuitest_coverfunc("build/tabview/tabview.js", "_renderPanel", 259);
398 _yuitest_coverline("build/tabview/tabview.js", 260);
399 this.get('parent').get('panelNode')
400 .appendChild(this.get('panelNode'));
404 _yuitest_coverfunc("build/tabview/tabview.js", "_add", 264);
405 _yuitest_coverline("build/tabview/tabview.js", 265);
406 var parent = this.get('parent').get('contentBox'),
407 list = parent.get('listNode'),
408 panel = parent.get('panelNode');
410 _yuitest_coverline("build/tabview/tabview.js", 269);
412 _yuitest_coverline("build/tabview/tabview.js", 270);
413 list.appendChild(this.get('boundingBox'));
416 _yuitest_coverline("build/tabview/tabview.js", 273);
418 _yuitest_coverline("build/tabview/tabview.js", 274);
419 panel.appendChild(this.get('panelNode'));
423 _remove: function() {
424 _yuitest_coverfunc("build/tabview/tabview.js", "_remove", 278);
425 _yuitest_coverline("build/tabview/tabview.js", 279);
426 this.get('boundingBox').remove();
427 _yuitest_coverline("build/tabview/tabview.js", 280);
428 this.get('panelNode').remove();
431 _onActivate: function(e) {
432 _yuitest_coverfunc("build/tabview/tabview.js", "_onActivate", 283);
433 _yuitest_coverline("build/tabview/tabview.js", 284);
434 if (e.target === this) {
435 // Prevent the browser from navigating to the URL specified by the
436 // anchor's href attribute.
437 _yuitest_coverline("build/tabview/tabview.js", 287);
438 e.domEvent.preventDefault();
439 _yuitest_coverline("build/tabview/tabview.js", 288);
440 e.target.set('selected', 1);
444 initializer: function() {
445 _yuitest_coverfunc("build/tabview/tabview.js", "initializer", 292);
446 _yuitest_coverline("build/tabview/tabview.js", 293);
447 this.publish(this.get('triggerEvent'), {
448 defaultFn: this._onActivate
452 _defLabelSetter: function(label) {
453 _yuitest_coverfunc("build/tabview/tabview.js", "_defLabelSetter", 298);
454 _yuitest_coverline("build/tabview/tabview.js", 299);
455 this.get('contentBox').setContent(label);
456 _yuitest_coverline("build/tabview/tabview.js", 300);
460 _defContentSetter: function(content) {
461 _yuitest_coverfunc("build/tabview/tabview.js", "_defContentSetter", 303);
462 _yuitest_coverline("build/tabview/tabview.js", 304);
463 this.get('panelNode').setContent(content);
464 _yuitest_coverline("build/tabview/tabview.js", 305);
468 _defContentGetter: function(content) {
469 _yuitest_coverfunc("build/tabview/tabview.js", "_defContentGetter", 308);
470 _yuitest_coverline("build/tabview/tabview.js", 309);
471 return this.get('panelNode').getContent();
474 // find panel by ID mapping from label href
475 _defPanelNodeValueFn: function() {
476 _yuitest_coverfunc("build/tabview/tabview.js", "_defPanelNodeValueFn", 313);
477 _yuitest_coverline("build/tabview/tabview.js", 314);
478 var href = this.get('contentBox').get('href') || '',
479 parent = this.get('parent'),
480 hashIndex = href.indexOf('#'),
483 _yuitest_coverline("build/tabview/tabview.js", 319);
484 href = href.substr(hashIndex);
486 _yuitest_coverline("build/tabview/tabview.js", 321);
487 if (href.charAt(0) === '#') { // in-page nav, find by ID
488 _yuitest_coverline("build/tabview/tabview.js", 322);
490 _yuitest_coverline("build/tabview/tabview.js", 323);
492 _yuitest_coverline("build/tabview/tabview.js", 324);
493 panel.addClass(_classNames.tabPanel);
497 // use the one found by id, or else try matching indices
498 _yuitest_coverline("build/tabview/tabview.js", 329);
499 if (!panel && parent) {
500 _yuitest_coverline("build/tabview/tabview.js", 330);
501 panel = parent.get('panelNode')
502 .get('children').item(this.get('index'));
505 _yuitest_coverline("build/tabview/tabview.js", 334);
506 if (!panel) { // create if none found
507 _yuitest_coverline("build/tabview/tabview.js", 335);
508 panel = Y.Node.create(this.PANEL_TEMPLATE);
510 _yuitest_coverline("build/tabview/tabview.js", 337);
516 * @attribute triggerEvent
529 setter: '_defLabelSetter',
530 validator: Lang.isString
538 setter: '_defContentSetter',
539 getter: '_defContentGetter'
543 * @attribute panelNode
547 setter: function(node) {
548 _yuitest_coverfunc("build/tabview/tabview.js", "setter", 373);
549 _yuitest_coverline("build/tabview/tabview.js", 374);
551 _yuitest_coverline("build/tabview/tabview.js", 375);
553 _yuitest_coverline("build/tabview/tabview.js", 376);
554 node.addClass(_classNames.tabPanel);
556 _yuitest_coverline("build/tabview/tabview.js", 378);
559 valueFn: '_defPanelNodeValueFn'
564 validator: '_validTabIndex'
570 selected: function(contentBox) {
571 _yuitest_coverfunc("build/tabview/tabview.js", "selected", 391);
572 _yuitest_coverline("build/tabview/tabview.js", 392);
573 var ret = (this.get('boundingBox').hasClass(_classNames.selectedTab)) ?
575 _yuitest_coverline("build/tabview/tabview.js", 394);
583 }, '3.7.2', {"requires": ["widget", "widget-parent", "widget-child", "tabview-base", "node-pluginhost", "node-focusmanager"], "skinnable": true});