Skip to content
Permalink
Browse files

Menu: Convert tests to new infrastructure

Ref #10119
Ref gh-1528
  • Loading branch information...
scottgonzalez committed Apr 6, 2015
1 parent a0e3da0 commit f2ca8f92f0d9ab9c7bf2e202e7ff7778daeef85c
@@ -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;
@@ -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
}
});

} );
@@ -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 );
} );
@@ -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 );
} );
@@ -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 );
} );
@@ -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 );
} );
@@ -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 = {
}
};

})();
} );

0 comments on commit f2ca8f9

Please sign in to comment.
You can’t perform that action at this time.