Created
September 23, 2010 18:03
-
-
Save maplpro/594062 to your computer and use it in GitHub Desktop.
testing with goog.testing
This file contains hidden or 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
goog.require('goog.testing.asserts'); | |
goog.require('infoportal.ui'); | |
var tb; | |
function setUp() { | |
tb = infoportal.ui.init(); | |
} | |
function tearDown() { | |
tb.dispose(); | |
} | |
function testTabBar() { | |
assertNotNull( tb ); | |
}; | |
function testTabsNumber() { | |
var i = 0; | |
tb.forEachChild( function () { i++; } ); | |
assertEquals(5, i); | |
}; | |
function testSelected() { | |
first = tb.getSelectedTab(); | |
assertNotNull( first ); | |
assertEquals( 'Enterprise', first.content_ ); | |
}; |
This file contains hidden or 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
<!doctype html> | |
<html> | |
<head> | |
<title>Information Portal</title> | |
</head> | |
<body> | |
<div id="menu"></div> | |
<script src="../closure-library/closure/goog/base.js"></script> | |
<script>goog.require('goog.testing.jsunit');</script> | |
<script src="core.js"></script> | |
<script src="tests.js"></script> | |
<script> | |
</script> | |
</body> | |
</html> |
This file contains hidden or 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
goog.require( 'goog.ui.TabBar' ); | |
goog.provide( 'infoportal.ui' ); | |
infoportal.ui.init = function () { | |
tb = new goog.ui.TabBar(); | |
goog.array.forEach( | |
['Enterprise', 'Farms', 'Web Application', 'Site Collections', 'Sites'], | |
function (name) { | |
tb.addChild( new goog.ui.Tab( name ), true ); | |
} | |
); | |
tb.setSelectedTabIndex(0); | |
return tb; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment