Created
August 29, 2013 16:51
-
-
Save marcellustavares/6380587 to your computer and use it in GitHub Desktop.
TabView unit tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YUI.add('module-tests', function(Y) { | |
//-------------------------------------------------------------------------- | |
// AUI TabView Unit Tests | |
//-------------------------------------------------------------------------- | |
var suite = new Y.Test.Suite('aui-tabview'), | |
tabView; | |
tabView = new Y.TabView({ | |
srcNode: '#myTab' | |
}).render(); | |
//-------------------------------------------------------------------------- | |
// Test Case for invalid fields | |
//-------------------------------------------------------------------------- | |
suite.add(new Y.Test.Case({ | |
name: 'Tabview Tests', | |
'verify active tab from markup': function() { | |
var activeTab = tabView.getActiveTab(), | |
tabs = tabView.getTabs(); | |
Y.Assert.areEqual(1, tabs.indexOf(activeTab)); | |
}, | |
'verify disabled tab from markup': function() { | |
var tabs = tabView.getTabs(); | |
var disabledTabs = []; | |
tabs.each(function(node, i) { | |
if (node.hasClass('disabled')) { | |
disabledTabs.push(node); | |
} | |
}); | |
Y.Assert.areEqual(1, disabledTabs.length); | |
Y.Assert.areEqual(2, tabs.indexOf(disabledTabs[0])); | |
} | |
})); | |
Y.Test.Runner.add(suite); | |
},'', { requires: [ 'test', 'aui-tabview' ] }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment