Skip to content

Commit

Permalink
It seems sinon is used by the docs, and need to be runable in the bro…
Browse files Browse the repository at this point in the history
…wser.

Revert "Move installation and config of sinon from bower+requirejs to karma-sinon. Sinon is a testing tool and don't belong in our main module requirements. Keep all dev-dependencies in package.json"

This reverts commit 22099dc.
  • Loading branch information
sunew committed Sep 19, 2018
1 parent e4fe63c commit 33e2822
Show file tree
Hide file tree
Showing 23 changed files with 49 additions and 80 deletions.
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"cs-jqtree-contextmenu": "^0.1.0"
},
"devDependencies": {
"expect": "0.3.1"
"expect": "0.3.1",
"sinonjs": "1.17.1"
},
"resolutions": {
"bootstrap": "3.3.6",
Expand Down
3 changes: 1 addition & 2 deletions mockup/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"require": false,
"requirejs": true,
"tinymce": true,
"window": false,
"sinon": true
"window": false
}
}
2 changes: 2 additions & 0 deletions mockup/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
'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',
Expand Down Expand Up @@ -167,6 +168,7 @@
'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 () {
Expand Down
10 changes: 2 additions & 8 deletions mockup/js/grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@
karma: {
options: {
basePath: './',
frameworks: ['mocha', 'sinon'],
frameworks: ['mocha'],
files: this.files.concat([
{
pattern:
Expand All @@ -461,7 +461,6 @@
browsers: ['PhantomJS'],
plugins: [
'karma-mocha',
'karma-sinon',
'karma-requirejs',
'karma-phantomjs-launcher',
'karma-spec-reporter'
Expand All @@ -479,7 +478,6 @@
browsers: ['PhantomJS'],
plugins: [
'karma-mocha',
'karma-sinon',
'karma-coverage',
'karma-requirejs',
'karma-phantomjs-launcher',
Expand All @@ -498,7 +496,6 @@
},
plugins: [
'karma-mocha',
'karma-sinon',
'karma-requirejs',
'karma-phantomjs-launcher',
'karma-junit-reporter',
Expand All @@ -517,7 +514,6 @@
// },
plugins: [
'karma-mocha',
'karma-sinon',
'karma-requirejs',
'karma-chrome-launcher',
'karma-spec-reporter'
Expand All @@ -535,15 +531,14 @@
// },
plugins: [
'karma-mocha',
'karma-sinon',
'karma-requirejs',
'karma-firefox-launcher',
'karma-spec-reporter'
]
},
testServe: {
reporters: ['dots', 'progress'],
plugins: ['karma-mocha', 'karma-sinon', 'karma-requirejs']
plugins: ['karma-mocha', 'karma-requirejs']
},
testCI: {
singleRun: true,
Expand All @@ -557,7 +552,6 @@
browsers: BROWSERS,
plugins: [
'karma-mocha',
'karma-sinon',
'karma-coverage',
'karma-requirejs',
'karma-sauce-launcher',
Expand Down
3 changes: 2 additions & 1 deletion mockup/tests/fakeserver.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
define([
'sinon',
'jquery',
'underscore'
], function($, _) {
], function(sinon, $, _) {
'use strict';

function getQueryVariable(url, variable) {
Expand Down
5 changes: 3 additions & 2 deletions mockup/tests/i18n-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
define([
'expect',
'jquery',
'mockup-i18n'
], function(expect, $, I18n) {
'mockup-i18n',
'sinon'
], function(expect, $, I18n, sinon) {
'use strict';

window.mocha.setup('bdd');
Expand Down
5 changes: 3 additions & 2 deletions mockup/tests/pattern-contentloader-test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
define([
'expect',
'jquery',
'sinon',
'pat-registry',
'mockup-patterns-contentloader'
], function(expect, $, registry, ContentLoader) {
], function(expect, $, sinon, registry, ContentLoader) {
'use strict';

window.mocha.setup('bdd');
$.fx.off = true;

/* ==========================
TEST: Livesearch
TEST: Livesearch
========================== */

describe('Livesearch', function() {
Expand Down
9 changes: 5 additions & 4 deletions mockup/tests/pattern-cookietrigger-test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
define([
'expect',
'jquery',
'sinon',
'pat-registry',
'mockup-patterns-cookietrigger'
], function(expect, $, registry, Pattern) {
], function(expect, $, sinon, registry, Pattern) {
'use strict';

window.mocha.setup('bdd');
$.fx.off = true;

/* ====================
TEST: Cookie Trigger
TEST: Cookie Trigger
==================== */

describe('Cookie Trigger', function () {
Expand All @@ -19,7 +20,7 @@ define([
});

it('The .pat-cookietrigger DOM element is shown if cookies are disabled', function() {
var widget =
var widget =
'<div class="portalMessage error pat-cookietrigger">' +
' Cookies are not enabled. You must enable cookies before you can log in.' +
'</div>';
Expand All @@ -32,7 +33,7 @@ define([
});

it('The .pat-cookietrigger DOM element is hidden if cookies are enabled', function() {
var widget =
var widget =
'<div class="portalMessage error pat-cookietrigger">' +
' Cookies are not enabled. You must enable cookies before you can log in.' +
'</div>';
Expand Down
3 changes: 2 additions & 1 deletion mockup/tests/pattern-filemanager-test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
define([
'sinon',
'expect',
'jquery',
'pat-registry',
'mockup-patterns-filemanager'
], function(expect, $, registry, Tree) {
], function(sinon, expect, $, registry, Tree) {
'use strict';

window.mocha.setup('bdd');
Expand Down
3 changes: 2 additions & 1 deletion mockup/tests/pattern-inlinevalidation-test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
define([
'expect',
'jquery',
'sinon',
'pat-registry',
'mockup-patterns-inlinevalidation'
], function(expect, $, registry, Pattern) {
], function(expect, $, sinon, registry, Pattern) {
'use strict';

window.mocha.setup('bdd');
Expand Down
5 changes: 3 additions & 2 deletions mockup/tests/pattern-livesearch-test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
define([
'expect',
'jquery',
'sinon',
'pat-registry',
'mockup-patterns-livesearch'
], function(expect, $, registry, Livesearch) {
], function(expect, $, sinon, registry, Livesearch) {
'use strict';

window.mocha.setup('bdd');
$.fx.off = true;

/* ==========================
TEST: Livesearch
TEST: Livesearch
========================== */

describe('Livesearch', function() {
Expand Down
3 changes: 2 additions & 1 deletion mockup/tests/pattern-modal-test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
define([
'expect',
'jquery',
'sinon',
'pat-registry',
'mockup-patterns-modal'
], function(expect, $, registry, Modal) {
], function(expect, $, sinon, registry, Modal) {
'use strict';

window.mocha.setup('bdd');
Expand Down
3 changes: 2 additions & 1 deletion mockup/tests/pattern-pickadate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
define([
'expect',
'jquery',
'sinon',
'pat-registry',
'mockup-patterns-pickadate',
'mockup-patterns-select2'
], function(expect, $, registry, PickADate) {
], function(expect, $, sinon, registry, PickADate) {
'use strict';

window.mocha.setup('bdd');
Expand Down
3 changes: 2 additions & 1 deletion mockup/tests/pattern-relateditems-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ define([
'expect',
'jquery',
'underscore',
'sinon',
'pat-registry',
'mockup-patterns-relateditems'
], function(expect, $, _, registry, RelatedItems) {
], function(expect, $, _, sinon, registry, RelatedItems) {
'use strict';

window.mocha.setup('bdd').globals(['jQuery*']);
Expand Down
5 changes: 3 additions & 2 deletions mockup/tests/pattern-resourceregistry-test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
define([
'sinon',
'expect',
'jquery',
'pat-registry',
'mockup-patterns-resourceregistry'
], function(expect, $, registry, ResourceRegistry) {
], function(sinon, expect, $, registry, ResourceRegistry) {
'use strict';

window.mocha.setup('bdd');
Expand Down Expand Up @@ -139,4 +140,4 @@ define([

});

});
});
3 changes: 2 additions & 1 deletion mockup/tests/pattern-select2-test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
define([
'expect',
'jquery',
'sinon',
'pat-registry',
'mockup-patterns-select2'
], function(expect, $, registry, Select2) {
], function(expect, $, sinon, registry, Select2) {
'use strict';

window.mocha.setup('bdd');
Expand Down
3 changes: 2 additions & 1 deletion mockup/tests/pattern-structure-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ 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, moment) {
TableView, TableRowView, PropertiesView, ResultCollection, utils, sinon, moment) {
'use strict';

window.mocha.setup('bdd');
Expand Down
3 changes: 2 additions & 1 deletion mockup/tests/pattern-thememapper-test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
define([
'expect',
'sinon',
'jquery',
'pat-registry',
'mockup-patterns-thememapper',
], function(expect, $, registry, RuleBuilderView ) {
], function(expect, sinon, $, registry, RuleBuilderView ) {
'use strict';

window.mocha.setup('bdd');
Expand Down
3 changes: 2 additions & 1 deletion mockup/tests/pattern-tinymce-test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
define([
'expect',
'jquery',
'sinon',
'pat-registry',
'tinymce',
'mockup-patterns-tinymce'
], function(expect, $, registry, tinymce, TinyMCE) {
], function(expect, $, sinon, registry, tinymce, TinyMCE) {
'use strict';

window.mocha.setup('bdd');
Expand Down
5 changes: 3 additions & 2 deletions mockup/tests/pattern-toggle-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ define([
'jquery',
'pat-registry',
'pat-logger',
'mockup-patterns-toggle'
], function(expect, $, registry, logger, Toggle) {
'mockup-patterns-toggle',
'sinon',
], function(expect, $, registry, logger, Toggle, sinon) {
'use strict';

window.mocha.setup('bdd');
Expand Down
2 changes: 1 addition & 1 deletion mockup/tests/utils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 33e2822

Please sign in to comment.