diff --git a/bower.json b/bower.json index 07da0f87e..4819a2de9 100644 --- a/bower.json +++ b/bower.json @@ -50,8 +50,7 @@ "cs-jqtree-contextmenu": "^0.1.0" }, "devDependencies": { - "expect": "0.3.1", - "sinonjs": "1.17.1" + "expect": "0.3.1" }, "resolutions": { "bootstrap": "3.3.6", diff --git a/mockup/.jshintrc b/mockup/.jshintrc index 86ea3b803..df08f23fc 100644 --- a/mockup/.jshintrc +++ b/mockup/.jshintrc @@ -26,6 +26,7 @@ "require": false, "requirejs": true, "tinymce": true, - "window": false + "window": false, + "sinon": true } } diff --git a/mockup/js/config.js b/mockup/js/config.js index c71ef8dba..86252d617 100644 --- a/mockup/js/config.js +++ b/mockup/js/config.js @@ -134,7 +134,6 @@ 'picker.time': 'bower_components/pickadate/lib/picker.time', 'react': 'bower_components/react/react', 'select2': 'bower_components/select2/select2', - 'sinon': 'bower_components/sinonjs/sinon', 'text': 'bower_components/requirejs-text/text', 'tinymce': 'bower_components/tinymce-builded/js/tinymce/tinymce', 'tinymce-modern-theme': 'bower_components/tinymce-builded/js/tinymce/themes/modern/theme', @@ -168,7 +167,6 @@ 'jquery.event.drop': { deps: ['jquery'], exports: '$.drop' }, 'picker.date': { deps: [ 'picker' ] }, 'picker.time': { deps: [ 'picker' ] }, - 'sinon': { exports: 'window.sinon' }, 'tinymce': { exports: 'window.tinyMCE', init: function () { diff --git a/mockup/js/grunt.js b/mockup/js/grunt.js index 9005c5e6a..5d33b0e88 100644 --- a/mockup/js/grunt.js +++ b/mockup/js/grunt.js @@ -321,7 +321,7 @@ karma: { options: { basePath: './', - frameworks: ['mocha', 'chai'], + frameworks: ['mocha', 'chai', 'sinon'], files: this.files.concat([ {pattern: 'bower_components/tinymce-builded/js/tinymce/skins/lightgray/content.min.css', watched: false, included: true, served: true, nocache: true} ]), @@ -338,6 +338,7 @@ plugins: [ 'karma-mocha', 'karma-chai', + 'karma-sinon', 'karma-coverage', 'karma-requirejs', 'karma-sauce-launcher', @@ -371,6 +372,7 @@ plugins: [ 'karma-mocha', 'karma-chai', + 'karma-sinon', 'karma-requirejs', 'karma-chrome-launcher' ] @@ -382,6 +384,7 @@ plugins: [ 'karma-mocha', 'karma-chai', + 'karma-sinon', 'karma-requirejs', 'karma-firefox-launcher' ] @@ -392,6 +395,7 @@ plugins: [ 'karma-mocha', 'karma-chai', + 'karma-sinon', 'karma-requirejs' ] }, diff --git a/mockup/tests/fakeserver.js b/mockup/tests/fakeserver.js index 296e575fd..b26f926da 100644 --- a/mockup/tests/fakeserver.js +++ b/mockup/tests/fakeserver.js @@ -1,8 +1,7 @@ define([ - 'sinon', 'jquery', 'underscore' -], function(sinon, $, _) { +], function($, _) { 'use strict'; function getQueryVariable(url, variable) { diff --git a/mockup/tests/i18n-test.js b/mockup/tests/i18n-test.js index 392e6a40e..365842a58 100644 --- a/mockup/tests/i18n-test.js +++ b/mockup/tests/i18n-test.js @@ -1,9 +1,8 @@ define([ 'expect', 'jquery', - 'mockup-i18n', - 'sinon' -], function(expect, $, I18n, sinon) { + 'mockup-i18n' +], function(expect, $, I18n) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-contentloader-test.js b/mockup/tests/pattern-contentloader-test.js index 0c38eab6a..fd66e36b7 100644 --- a/mockup/tests/pattern-contentloader-test.js +++ b/mockup/tests/pattern-contentloader-test.js @@ -1,17 +1,16 @@ define([ 'expect', 'jquery', - 'sinon', 'pat-registry', 'mockup-patterns-contentloader' -], function(expect, $, sinon, registry, ContentLoader) { +], function(expect, $, registry, ContentLoader) { 'use strict'; window.mocha.setup('bdd'); $.fx.off = true; /* ========================== - TEST: Livesearch + TEST: Livesearch ========================== */ describe('Livesearch', function() { diff --git a/mockup/tests/pattern-cookietrigger-test.js b/mockup/tests/pattern-cookietrigger-test.js index 3c7d5eb13..5d3952fb8 100644 --- a/mockup/tests/pattern-cookietrigger-test.js +++ b/mockup/tests/pattern-cookietrigger-test.js @@ -1,17 +1,16 @@ define([ 'expect', 'jquery', - 'sinon', 'pat-registry', 'mockup-patterns-cookietrigger' -], function(expect, $, sinon, registry, Pattern) { +], function(expect, $, registry, Pattern) { 'use strict'; window.mocha.setup('bdd'); $.fx.off = true; /* ==================== - TEST: Cookie Trigger + TEST: Cookie Trigger ==================== */ describe('Cookie Trigger', function () { @@ -20,7 +19,7 @@ define([ }); it('The .pat-cookietrigger DOM element is shown if cookies are disabled', function() { - var widget = + var widget = '
' + ' Cookies are not enabled. You must enable cookies before you can log in.' + '
'; @@ -33,7 +32,7 @@ define([ }); it('The .pat-cookietrigger DOM element is hidden if cookies are enabled', function() { - var widget = + var widget = '
' + ' Cookies are not enabled. You must enable cookies before you can log in.' + '
'; diff --git a/mockup/tests/pattern-filemanager-test.js b/mockup/tests/pattern-filemanager-test.js index ee5d3ded4..1bf3fb3ea 100644 --- a/mockup/tests/pattern-filemanager-test.js +++ b/mockup/tests/pattern-filemanager-test.js @@ -1,10 +1,9 @@ define([ - 'sinon', 'expect', 'jquery', 'pat-registry', 'mockup-patterns-filemanager' -], function(sinon, expect, $, registry, Tree) { +], function(expect, $, registry, Tree) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-inlinevalidation-test.js b/mockup/tests/pattern-inlinevalidation-test.js index c4f425c96..79433236c 100644 --- a/mockup/tests/pattern-inlinevalidation-test.js +++ b/mockup/tests/pattern-inlinevalidation-test.js @@ -1,10 +1,9 @@ define([ 'expect', 'jquery', - 'sinon', 'pat-registry', 'mockup-patterns-inlinevalidation' -], function(expect, $, sinon, registry, Pattern) { +], function(expect, $, registry, Pattern) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-livesearch-test.js b/mockup/tests/pattern-livesearch-test.js index 0a69950b2..4a82e60fa 100644 --- a/mockup/tests/pattern-livesearch-test.js +++ b/mockup/tests/pattern-livesearch-test.js @@ -1,17 +1,16 @@ define([ 'expect', 'jquery', - 'sinon', 'pat-registry', 'mockup-patterns-livesearch' -], function(expect, $, sinon, registry, Livesearch) { +], function(expect, $, registry, Livesearch) { 'use strict'; window.mocha.setup('bdd'); $.fx.off = true; /* ========================== - TEST: Livesearch + TEST: Livesearch ========================== */ describe('Livesearch', function() { diff --git a/mockup/tests/pattern-modal-test.js b/mockup/tests/pattern-modal-test.js index c14c53c8f..ec42bd603 100644 --- a/mockup/tests/pattern-modal-test.js +++ b/mockup/tests/pattern-modal-test.js @@ -1,10 +1,9 @@ define([ 'expect', 'jquery', - 'sinon', 'pat-registry', 'mockup-patterns-modal' -], function(expect, $, sinon, registry, Modal) { +], function(expect, $, registry, Modal) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-pickadate-test.js b/mockup/tests/pattern-pickadate-test.js index 1b35b0c4f..17ba1302a 100644 --- a/mockup/tests/pattern-pickadate-test.js +++ b/mockup/tests/pattern-pickadate-test.js @@ -2,11 +2,10 @@ define([ 'expect', 'jquery', - 'sinon', 'pat-registry', 'mockup-patterns-pickadate', 'mockup-patterns-select2' -], function(expect, $, sinon, registry, PickADate) { +], function(expect, $, registry, PickADate) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-relateditems-test.js b/mockup/tests/pattern-relateditems-test.js index 1563b029c..9ec5ca462 100644 --- a/mockup/tests/pattern-relateditems-test.js +++ b/mockup/tests/pattern-relateditems-test.js @@ -2,10 +2,9 @@ define([ 'expect', 'jquery', 'underscore', - 'sinon', 'pat-registry', 'mockup-patterns-relateditems' -], function(expect, $, _, sinon, registry, RelatedItems) { +], function(expect, $, _, registry, RelatedItems) { 'use strict'; window.mocha.setup('bdd').globals(['jQuery*']); diff --git a/mockup/tests/pattern-resourceregistry-test.js b/mockup/tests/pattern-resourceregistry-test.js index 6c99c51d9..9eb0e002a 100644 --- a/mockup/tests/pattern-resourceregistry-test.js +++ b/mockup/tests/pattern-resourceregistry-test.js @@ -1,10 +1,9 @@ define([ - 'sinon', 'expect', 'jquery', 'pat-registry', 'mockup-patterns-resourceregistry' -], function(sinon, expect, $, registry, ResourceRegistry) { +], function(expect, $, registry, ResourceRegistry) { 'use strict'; window.mocha.setup('bdd'); @@ -140,4 +139,4 @@ define([ }); -}); \ No newline at end of file +}); diff --git a/mockup/tests/pattern-select2-test.js b/mockup/tests/pattern-select2-test.js index 730ce32e2..7a846ed20 100644 --- a/mockup/tests/pattern-select2-test.js +++ b/mockup/tests/pattern-select2-test.js @@ -1,10 +1,9 @@ define([ 'expect', 'jquery', - 'sinon', 'pat-registry', 'mockup-patterns-select2' -], function(expect, $, sinon, registry, Select2) { +], function(expect, $, registry, Select2) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-structure-test.js b/mockup/tests/pattern-structure-test.js index 8fb103f2c..3076b0130 100644 --- a/mockup/tests/pattern-structure-test.js +++ b/mockup/tests/pattern-structure-test.js @@ -13,10 +13,9 @@ define([ 'mockup-patterns-structure-url/js/views/generic-popover', 'mockup-patterns-structure-url/js/collections/result', 'mockup-utils', - 'sinon', 'moment' ], function(expect, $, _, registry, ButtonView, Structure, ActionMenuView, AppView, Result, - TableView, TableRowView, PropertiesView, ResultCollection, utils, sinon, moment) { + TableView, TableRowView, PropertiesView, ResultCollection, utils, moment) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-thememapper-test.js b/mockup/tests/pattern-thememapper-test.js index f7362f7c4..84d70801f 100644 --- a/mockup/tests/pattern-thememapper-test.js +++ b/mockup/tests/pattern-thememapper-test.js @@ -1,10 +1,9 @@ define([ 'expect', - 'sinon', 'jquery', 'pat-registry', 'mockup-patterns-thememapper', -], function(expect, sinon, $, registry, RuleBuilderView ) { +], function(expect, $, registry, RuleBuilderView ) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-tinymce-test.js b/mockup/tests/pattern-tinymce-test.js index 7a7ebc43d..f8ae4eec2 100644 --- a/mockup/tests/pattern-tinymce-test.js +++ b/mockup/tests/pattern-tinymce-test.js @@ -1,11 +1,10 @@ define([ 'expect', 'jquery', - 'sinon', 'pat-registry', 'tinymce', 'mockup-patterns-tinymce' -], function(expect, $, sinon, registry, tinymce, TinyMCE) { +], function(expect, $, registry, tinymce, TinyMCE) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-toggle-test.js b/mockup/tests/pattern-toggle-test.js index ef0b50b91..a09123110 100644 --- a/mockup/tests/pattern-toggle-test.js +++ b/mockup/tests/pattern-toggle-test.js @@ -3,9 +3,8 @@ define([ 'jquery', 'pat-registry', 'pat-logger', - 'mockup-patterns-toggle', - 'sinon', -], function(expect, $, registry, logger, Toggle, sinon) { + 'mockup-patterns-toggle' +], function(expect, $, registry, logger, Toggle) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/utils-test.js b/mockup/tests/utils-test.js index 0c3ed7611..e04b23445 100644 --- a/mockup/tests/utils-test.js +++ b/mockup/tests/utils-test.js @@ -97,7 +97,7 @@ define([ expect(utils.bool(13)).to.be.equal(true); expect(utils.bool('foo')).to.be.equal(true); }); - + it('returns false for falsy values', function() { expect(utils.bool('false')).to.be.equal(false); expect(utils.bool(' false ')).to.be.equal(false); diff --git a/package.json b/package.json index 53b1ef6aa..1725319ed 100644 --- a/package.json +++ b/package.json @@ -30,11 +30,13 @@ "karma-sauce-launcher": "~1.0.0", "karma-script-launcher": "~1.0.0", "karma-spec-reporter": "0.0.26", + "karma-sinon": "^1.0.5", "lcov-result-merger": "~1.2.0", "less": "~1.7.0", "mocha": "~2.5.3", "phantomjs-prebuilt": "^2.1.7", - "requirejs": "~2.2.0" + "requirejs": "~2.2.0", + "sinon": "1.17.1" }, "maintainers": [ {