Menu: Convert tests to new infrastructure

Ref #10119
Ref gh-1528
This commit is contained in:
Scott González 2015-04-06 13:04:04 -04:00
parent a0e3da0459
commit f2ca8f92f0
7 changed files with 53 additions and 53 deletions

View File

@ -4,31 +4,8 @@
<meta charset="utf-8">
<title>jQuery UI Menu Test Suite</title>
<script src="../../jquery.js"></script>
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
<script src="../../../external/qunit/qunit.js"></script>
<script src="../../../external/jquery-simulate/jquery.simulate.js"></script>
<script src="../testsuite.js"></script>
<script src="../../../external/qunit-assert-classes/qunit-assert-classes.js"></script>
<script>
TestHelpers.loadResources({
css: [ "core", "menu" ],
js: [
"ui/core.js",
"ui/widget.js",
"ui/menu.js"
]
});
</script>
<script src="menu_test_helpers.js"></script>
<script src="menu_common.js"></script>
<script src="menu_core.js"></script>
<script src="menu_events.js"></script>
<script src="menu_methods.js"></script>
<script src="menu_options.js"></script>
<script src="../swarminject.js"></script>
<script src="../../lib/css.js" data-modules="core menu"></script>
<script src="../../lib/bootstrap.js" data-widget="menu"></script>
<style>
.ui-menu {
font-size: 15px;

View File

@ -1,4 +1,9 @@
TestHelpers.commonWidgetTests( "menu", {
define( [
"lib/common",
"ui/menu"
], function( common ) {
common.testWidget( "menu", {
defaults: {
classes: {},
disabled: false,
@ -20,3 +25,5 @@ TestHelpers.commonWidgetTests( "menu", {
select: null
}
});
} );

View File

@ -1,4 +1,8 @@
(function( $ ) {
define( [
"jquery",
"./menu_test_helpers",
"ui/menu"
], function( $, menuTestHelpers ) {
module( "menu: core" );
@ -47,7 +51,7 @@ asyncTest( "#9044: Autofocus issue with dialog opened from menu widget", functio
$( "#test9044" ).focus();
});
TestHelpers.menu.click( element, "3" );
menuTestHelpers.click( element, "3" );
setTimeout( function() {
equal( document.activeElement.id, "test9044", "Focus was swallowed by menu" );
$( "#test9044" ).remove();
@ -69,4 +73,4 @@ asyncTest( "#9532: Need a way in Menu to keep ui-state-active class on selected
});
});
})( jQuery );
} );

View File

@ -1,12 +1,16 @@
(function( $ ) {
define( [
"jquery",
"./menu_test_helpers",
"ui/menu"
], function( $, menuTestHelpers ) {
var log = TestHelpers.menu.log,
logOutput = TestHelpers.menu.logOutput,
click = TestHelpers.menu.click;
var log = menuTestHelpers.log,
logOutput = menuTestHelpers.logOutput,
click = menuTestHelpers.click;
module( "menu: events", {
setup: function() {
TestHelpers.menu.clearLog();
menuTestHelpers.clearLog();
}
});
@ -730,4 +734,4 @@ asyncTest( "#10571: When typing in a menu, only menu-items should be focused", f
});
});
})( jQuery );
} );

View File

@ -1,21 +1,25 @@
(function( $ ) {
define( [
"jquery",
"./menu_test_helpers",
"ui/menu"
], function( $, menuTestHelpers ) {
var log = TestHelpers.menu.log,
logOutput = TestHelpers.menu.logOutput,
click = TestHelpers.menu.click;
var log = menuTestHelpers.log,
logOutput = menuTestHelpers.logOutput,
click = menuTestHelpers.click;
module( "menu: methods", {
setup: function() {
TestHelpers.menu.clearLog();
menuTestHelpers.clearLog();
}
});
test( "destroy", function() {
test( "destroy", function( assert ) {
expect( 2 );
domEqual( "#menu2", function() {
assert.domEqual( "#menu2", function() {
$( "#menu2" ).menu().menu( "destroy" );
});
domEqual( "#menu5", function() {
assert.domEqual( "#menu5", function() {
$( "#menu5").menu().menu( "destroy" );
});
});
@ -109,4 +113,4 @@ test( "widget", function() {
// TODO: test select method
})( jQuery );
} );

View File

@ -1,12 +1,16 @@
(function( $ ) {
define( [
"jquery",
"./menu_test_helpers",
"ui/menu"
], function( $, menuTestHelpers ) {
var log = TestHelpers.menu.log,
logOutput = TestHelpers.menu.logOutput,
click = TestHelpers.menu.click;
var log = menuTestHelpers.log,
logOutput = menuTestHelpers.logOutput,
click = menuTestHelpers.click;
module( "menu: options", {
setup: function() {
TestHelpers.menu.clearLog();
menuTestHelpers.clearLog();
}
});
@ -118,4 +122,4 @@ test( "{ role: null }", function( assert ) {
});
});
})( jQuery );
} );

View File

@ -1,9 +1,9 @@
(function() {
define( function() {
var lastItem,
log = [];
TestHelpers.menu = {
return {
log: function( message, clear ) {
if ( clear ) {
log.length = 0;
@ -30,4 +30,4 @@ TestHelpers.menu = {
}
};
})();
} );