diff options
-rw-r--r-- | grunt.js | 9 | ||||
-rw-r--r-- | tests/unit/widget/widget_extend.js | 17 |
2 files changed, 13 insertions, 13 deletions
@@ -271,9 +271,8 @@ grunt.initConfig({ // TODO remove items from this list once rewritten return !( /(effects.core|mouse|datepicker|draggable|droppable|resizable|selectable|sortable)\.js$/ ).test( file ); }), - grunt: "grunt.js" - // TODO enabled once fixed up - // tests: "tests/unit/**/*.js" + grunt: "grunt.js", + tests: "tests/unit/**/*.js" }, csslint: { // nothing: [] @@ -343,7 +342,9 @@ grunt.initConfig({ tests: { options: extend({ browser: true, - jquery: true + jquery: true, + // TODO: this is only for document.write() + evil: true }, defaults ), // TODO: don't create so many globals in tests globals: { diff --git a/tests/unit/widget/widget_extend.js b/tests/unit/widget/widget_extend.js index 36cd999dd..ae9855929 100644 --- a/tests/unit/widget/widget_extend.js +++ b/tests/unit/widget/widget_extend.js @@ -12,7 +12,14 @@ test( "$.widget.extend()", function() { deep2copy = { foo: { baz: true }, foo2: document }, deepmerged = { foo: { bar: true, baz: true }, foo2: document }, arr = [1, 2, 3], - nestedarray = { arr: arr }; + nestedarray = { arr: arr }, + defaults = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" }, + defaultsCopy = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" }, + options1 = { xnumber2: 1, xstring2: "x" }, + options1Copy = { xnumber2: 1, xstring2: "x" }, + options2 = { xstring2: "xx", xxx: "newstringx" }, + options2Copy = { xstring2: "xx", xxx: "newstringx" }, + merged2 = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "xx", xxx: "newstringx" }; $.widget.extend( settings, options ); deepEqual( settings, merged, "Check if extended: settings must be extended" ); @@ -79,14 +86,6 @@ test( "$.widget.extend()", function() { $.widget.extend( obj, { foo:"notnull" } ); equal( obj.foo, "notnull", "Make sure a null value can be overwritten" ); - var defaults = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" }, - defaultsCopy = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" }, - options1 = { xnumber2: 1, xstring2: "x" }, - options1Copy = { xnumber2: 1, xstring2: "x" }, - options2 = { xstring2: "xx", xxx: "newstringx" }, - options2Copy = { xstring2: "xx", xxx: "newstringx" }, - merged2 = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "xx", xxx: "newstringx" }; - settings = $.widget.extend( {}, defaults, options1, options2 ); deepEqual( settings, merged2, "Check if extended: settings must be extended" ); deepEqual( defaults, defaultsCopy, "Check if not modified: options1 must not be modified" ); |