mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-07-24 19:52:57 +03:00
Merge commit 'd32092c1f0
' as 'jquery-ui'
This commit is contained in:
commit
b23131fdc2
717 changed files with 518330 additions and 0 deletions
26
jquery-ui/tests/unit/form-reset-mixin/all.html
Normal file
26
jquery-ui/tests/unit/form-reset-mixin/all.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Form Reset Mixin Test Suite</title>
|
||||
|
||||
<script src="../../../external/jquery/jquery.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
|
||||
<link rel="stylesheet" href="../../../external/qunit-composite/qunit-composite.css">
|
||||
<script src="../../../external/qunit/qunit.js"></script>
|
||||
<script src="../../../external/qunit-composite/qunit-composite.js"></script>
|
||||
<script src="../subsuite.js"></script>
|
||||
|
||||
<script>
|
||||
testAllVersions( "form-reset-mixin" );
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture">
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
99
jquery-ui/tests/unit/form-reset-mixin/core.js
vendored
Normal file
99
jquery-ui/tests/unit/form-reset-mixin/core.js
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
define( [
|
||||
"qunit",
|
||||
"jquery",
|
||||
"lib/common",
|
||||
"ui/widget",
|
||||
"ui/form-reset-mixin"
|
||||
], function( QUnit, $, common ) {
|
||||
|
||||
QUnit.module( "widget factory", {
|
||||
beforeEach: function() {
|
||||
$.widget( "ui.testWidget", [ $.ui.formResetMixin, {
|
||||
_create: function() {
|
||||
this._bindFormResetHandler();
|
||||
},
|
||||
_destroy: function() {
|
||||
this._unbindFormResetHandler();
|
||||
},
|
||||
refresh: function() {
|
||||
$.ui.testWidget.refreshed.push( this.element.attr( "id" ) );
|
||||
}
|
||||
} ] );
|
||||
|
||||
$.ui.testWidget.refreshed = [];
|
||||
},
|
||||
|
||||
afterEach: function() {
|
||||
delete $.ui.testWidget;
|
||||
delete $.fn.testWidget;
|
||||
}
|
||||
} );
|
||||
|
||||
common.testJshint( "form-reset-mixin" );
|
||||
|
||||
QUnit.test( "form reset", function( assert ) {
|
||||
var ready = assert.async();
|
||||
assert.expect( 2 );
|
||||
|
||||
var form = $( "#main" );
|
||||
var inputs = form.find( "input" );
|
||||
|
||||
inputs.testWidget();
|
||||
form.on( "reset", function() {
|
||||
setTimeout( function() {
|
||||
assert.deepEqual( $.ui.testWidget.refreshed, [ "input1", "input2", "input3", "input4" ],
|
||||
"All widgets are refreshed on form reset" );
|
||||
assert.equal( form.data( "ui-form-reset-instances" ).length, 4,
|
||||
"All widget instances are tracked against the form" );
|
||||
ready();
|
||||
} );
|
||||
} );
|
||||
form[ 0 ].reset();
|
||||
} );
|
||||
|
||||
QUnit.test( "destroy", function( assert ) {
|
||||
var ready = assert.async();
|
||||
assert.expect( 2 );
|
||||
|
||||
var form = $( "#main" );
|
||||
var inputs = form.find( "input" );
|
||||
|
||||
inputs
|
||||
.testWidget()
|
||||
.eq( 1 )
|
||||
.testWidget( "destroy" );
|
||||
|
||||
form.on( "reset", function() {
|
||||
setTimeout( function() {
|
||||
assert.deepEqual( $.ui.testWidget.refreshed, [ "input1", "input3", "input4" ],
|
||||
"All widgets are refreshed on form reset" );
|
||||
assert.deepEqual( form.data( "ui-form-reset-instances" ).length, 3,
|
||||
"All widget instances are tracked against the form" );
|
||||
ready();
|
||||
} );
|
||||
} );
|
||||
form[ 0 ].reset();
|
||||
} );
|
||||
|
||||
QUnit.test( "destroy all", function( assert ) {
|
||||
var ready = assert.async();
|
||||
assert.expect( 2 );
|
||||
|
||||
var form = $( "#main" );
|
||||
|
||||
form.find( "input" )
|
||||
.testWidget()
|
||||
.testWidget( "destroy" );
|
||||
|
||||
form.on( "reset", function() {
|
||||
setTimeout( function() {
|
||||
assert.deepEqual( $.ui.testWidget.refreshed, [], "No widgets are refreshed after destroy" );
|
||||
assert.strictEqual( form.data( "ui-form-reset-instances" ), undefined,
|
||||
"Form data is removed when the last widget instance is destroyed" );
|
||||
ready();
|
||||
} );
|
||||
} );
|
||||
form[ 0 ].reset();
|
||||
} );
|
||||
|
||||
} );
|
26
jquery-ui/tests/unit/form-reset-mixin/form-reset-mixin.html
Normal file
26
jquery-ui/tests/unit/form-reset-mixin/form-reset-mixin.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Form Reset Mixin Test Suite</title>
|
||||
|
||||
<script src="../../../external/requirejs/require.js"></script>
|
||||
<script src="../../lib/css.js"></script>
|
||||
<script src="../../lib/bootstrap.js" data-modules="core">
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture">
|
||||
|
||||
<form id="main">
|
||||
<input id="input1">
|
||||
<input id="input2">
|
||||
<input id="input3">
|
||||
<input id="input4">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue