mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-09 19:13:26 +00:00
Fix tests
This commit is contained in:
@@ -12,7 +12,9 @@ module.exports = function(grunt) {
|
|||||||
'loadImages=false'
|
'loadImages=false'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
all: ['www/scripts/tests/index.html']
|
all: [
|
||||||
|
'www/scripts/tests/*.html'
|
||||||
|
]
|
||||||
},
|
},
|
||||||
qunit: {
|
qunit: {
|
||||||
all: ['www/include/js/tests/*.html']
|
all: ['www/include/js/tests/*.html']
|
||||||
|
@@ -146,7 +146,6 @@ class TaskManager implements ControllerProviderInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getScheduler(Application $app, Request $request)
|
public function getScheduler(Application $app, Request $request)
|
||||||
{
|
{
|
||||||
if ($request->getRequestFormat() !== "json") {
|
if ($request->getRequestFormat() !== "json") {
|
||||||
|
@@ -120,8 +120,6 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#<script src="/assets/autobahnjs/autobahn.js"></script>#}
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$("form[name='form-create-task'] select").bind("change", function() {
|
$("form[name='form-create-task'] select").bind("change", function() {
|
||||||
|
@@ -9,14 +9,14 @@
|
|||||||
|
|
||||||
define([
|
define([
|
||||||
"jquery",
|
"jquery",
|
||||||
"jqueryui",
|
|
||||||
"underscore",
|
"underscore",
|
||||||
"backbone",
|
"backbone",
|
||||||
"i18n",
|
"i18n",
|
||||||
"common/multiviews",
|
"common/multiviews",
|
||||||
"apps/admin/fields/views/listRow",
|
"apps/admin/fields/views/listRow",
|
||||||
"apps/admin/fields/views/create"
|
"apps/admin/fields/views/create",
|
||||||
], function ($, jqueryui, _, Backbone, i18n, MultiViews, FieldListRowView, CreateView) {
|
"jquery.ui"
|
||||||
|
], function ($, _, Backbone, i18n, MultiViews, FieldListRowView, CreateView) {
|
||||||
var FieldListView = Backbone.View.extend(_.extend({}, MultiViews, {
|
var FieldListView = Backbone.View.extend(_.extend({}, MultiViews, {
|
||||||
events: {
|
events: {
|
||||||
"keyup #live_search": "searchAction",
|
"keyup #live_search": "searchAction",
|
||||||
|
@@ -51,4 +51,4 @@ require.config({
|
|||||||
deps: ["jquery.ui.widget"]
|
deps: ["jquery.ui.widget"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -12,7 +12,7 @@ require.config({
|
|||||||
baseUrl: "/scripts",
|
baseUrl: "/scripts",
|
||||||
paths: {
|
paths: {
|
||||||
jquery: "../assets/jquery/jquery",
|
jquery: "../assets/jquery/jquery",
|
||||||
jqueryui: "../assets/jquery.ui/jquery-ui",
|
"jquery.ui": "../assets/jquery.ui/jquery-ui",
|
||||||
underscore: "../assets/underscore-amd/underscore",
|
underscore: "../assets/underscore-amd/underscore",
|
||||||
backbone: "../assets/backbone-amd/backbone",
|
backbone: "../assets/backbone-amd/backbone",
|
||||||
i18n: "../assets/i18next/i18next.amd-1.6.3",
|
i18n: "../assets/i18next/i18next.amd-1.6.3",
|
||||||
@@ -22,12 +22,12 @@ require.config({
|
|||||||
},
|
},
|
||||||
shim: {
|
shim: {
|
||||||
bootstrap: ["jquery"],
|
bootstrap: ["jquery"],
|
||||||
jqueryui: {
|
"jquery.ui": {
|
||||||
deps: ["jquery"]
|
deps: ["jquery"]
|
||||||
},
|
},
|
||||||
"jquery.geonames": {
|
"jquery.geonames": {
|
||||||
deps: ['jquery', 'jqueryui'],
|
deps: ["jquery", "jquery.ui"],
|
||||||
exports: '$.fn.geocompleter'
|
exports: "$.fn.geocompleter"
|
||||||
},
|
},
|
||||||
"common/geonames": {
|
"common/geonames": {
|
||||||
deps: ["jquery.geonames"]
|
deps: ["jquery.geonames"]
|
||||||
|
90
www/scripts/tests/admin.html
Normal file
90
www/scripts/tests/admin.html
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<title>Mocha Spec Runner</title>
|
||||||
|
<link rel="stylesheet" href="./../../../tmp-assets/mocha/mocha.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="mocha"></div>
|
||||||
|
<script src="./../../../tmp-assets/mocha/mocha.js"></script>
|
||||||
|
<script src="./../../../tmp-assets/sinonjs/sinon.js"></script>
|
||||||
|
<script src="../../assets/requirejs/require.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
require.config({
|
||||||
|
baseUrl: "../../scripts",
|
||||||
|
paths: {
|
||||||
|
"chai" : "../../tmp-assets/chai/chai",
|
||||||
|
"fixtures": "../../tmp-assets/js-fixtures/fixtures",
|
||||||
|
"jquery": "../assets/jquery/jquery",
|
||||||
|
"backbone": "../assets/backbone-amd/backbone",
|
||||||
|
"i18n": "../assets/i18next/i18next.amd-1.6.3",
|
||||||
|
"bootstrap": "../assets/bootstrap/js/bootstrap.min",
|
||||||
|
"sinonchai": "../../tmp-assets/sinon-chai/lib/sinon-chai",
|
||||||
|
"squire": "../../tmp-assets/squire/src/Squire",
|
||||||
|
"jquery.ui": "../assets/jquery.ui/jquery-ui",
|
||||||
|
"underscore": "../assets/underscore-amd/underscore",
|
||||||
|
"jquery.ui.widget": "../assets/jquery-file-upload/jquery.ui.widget",
|
||||||
|
"jquery.cookie": "../assets/jquery.cookie/jquery.cookie",
|
||||||
|
"jquery.treeview": "../assets/jquery.treeview/jquery.treeview",
|
||||||
|
"jquery.tooltip": "../assets/jquery.tooltip/jquery.tooltip",
|
||||||
|
"blueimp.loadimage" : "../assets/blueimp-load-image/load-image",
|
||||||
|
"jfu.iframe-transport": "../assets/jquery-file-upload/jquery.iframe-transport",
|
||||||
|
"jfu.fileupload": "../assets/jquery-file-upload/jquery.fileupload"
|
||||||
|
},
|
||||||
|
shim: {
|
||||||
|
"jquery.ui": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jquery.treeview": {
|
||||||
|
deps: ['jquery', 'jquery.cookie'],
|
||||||
|
exports: '$.fn.treeview'
|
||||||
|
},
|
||||||
|
bootstrap:{
|
||||||
|
deps: ['jquery']
|
||||||
|
},
|
||||||
|
"jquery.cookie": {
|
||||||
|
deps: ["jquery"],
|
||||||
|
exports: '$.fn.cookie'
|
||||||
|
},
|
||||||
|
"jquery.tooltip": {
|
||||||
|
deps: ["jquery"],
|
||||||
|
exports: '$.fn.tooltip'
|
||||||
|
},
|
||||||
|
"jquery.ui": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jquery.ui.widget": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jfu.fileupload": {
|
||||||
|
deps: ["jquery.ui.widget"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mocha.setup({
|
||||||
|
ui: "bdd",
|
||||||
|
ignoreLeaks: false,
|
||||||
|
globals: ['ab']
|
||||||
|
});
|
||||||
|
|
||||||
|
console = window.console || function () {};
|
||||||
|
|
||||||
|
window.notrack = true;
|
||||||
|
|
||||||
|
window.runMocha = function () {
|
||||||
|
if (window.mochaPhantomJS) {
|
||||||
|
mochaPhantomJS.run();
|
||||||
|
} else {
|
||||||
|
mocha.run();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
require([
|
||||||
|
'tests/specs/admin/fields',
|
||||||
|
'tests/specs/admin/taskmanager',
|
||||||
|
'tests/specs/admin/main'
|
||||||
|
], window.runMocha);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -1,4 +0,0 @@
|
|||||||
define(["chai"], function (shai) {
|
|
||||||
window.expect = shai.expect;
|
|
||||||
window.assert = shai.assert;
|
|
||||||
});
|
|
@@ -1,28 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<title>Mocha Spec Runner</title>
|
|
||||||
<link rel="stylesheet" href="./../../../tmp-assets/mocha/mocha.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="mocha"></div>
|
|
||||||
<script src="./../../../tmp-assets/mocha/mocha.js"></script>
|
|
||||||
<script src="./../../../tmp-assets/sinonjs/sinon.js"></script>
|
|
||||||
<script src="../../assets/requirejs/require.js"></script>
|
|
||||||
<script src="../../scripts/tests/main.js"></script>
|
|
||||||
<script>
|
|
||||||
require([
|
|
||||||
// 'tests/baseTest',
|
|
||||||
// 'specs/admin/fields',
|
|
||||||
// 'specs/admin/taskmanager',
|
|
||||||
'specs/admin/main',
|
|
||||||
// 'specs/login/home',
|
|
||||||
// 'specs/models',
|
|
||||||
// 'specs/validator',
|
|
||||||
// 'specs/websockets/connection',
|
|
||||||
// 'specs/websockets/subscriberManager'
|
|
||||||
], runMocha);
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
88
www/scripts/tests/login.html
Normal file
88
www/scripts/tests/login.html
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<title>Mocha Spec Runner</title>
|
||||||
|
<link rel="stylesheet" href="./../../../tmp-assets/mocha/mocha.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="mocha"></div>
|
||||||
|
<script src="./../../../tmp-assets/mocha/mocha.js"></script>
|
||||||
|
<script src="./../../../tmp-assets/sinonjs/sinon.js"></script>
|
||||||
|
<script src="../../assets/requirejs/require.js"></script>
|
||||||
|
<script>
|
||||||
|
require.config({
|
||||||
|
baseUrl: "../../scripts",
|
||||||
|
paths: {
|
||||||
|
"chai" : "../../tmp-assets/chai/chai",
|
||||||
|
"fixtures": "../../tmp-assets/js-fixtures/fixtures",
|
||||||
|
"jquery": "../assets/jquery/jquery",
|
||||||
|
"backbone": "../assets/backbone-amd/backbone",
|
||||||
|
"i18n": "../assets/i18next/i18next.amd-1.6.3",
|
||||||
|
"bootstrap": "../assets/bootstrap/js/bootstrap.min",
|
||||||
|
"sinonchai": "../../tmp-assets/sinon-chai/lib/sinon-chai",
|
||||||
|
"squire": "../../tmp-assets/squire/src/Squire",
|
||||||
|
"jquery.ui": "../assets/jquery.ui/jquery-ui",
|
||||||
|
"underscore": "../assets/underscore-amd/underscore",
|
||||||
|
"jquery.ui.widget": "../assets/jquery-file-upload/jquery.ui.widget",
|
||||||
|
"jquery.cookie": "../assets/jquery.cookie/jquery.cookie",
|
||||||
|
"jquery.treeview": "../assets/jquery.treeview/jquery.treeview",
|
||||||
|
"jquery.tooltip": "../assets/jquery.tooltip/jquery.tooltip",
|
||||||
|
"blueimp.loadimage" : "../assets/blueimp-load-image/load-image",
|
||||||
|
"jfu.iframe-transport": "../assets/jquery-file-upload/jquery.iframe-transport",
|
||||||
|
"jfu.fileupload": "../assets/jquery-file-upload/jquery.fileupload"
|
||||||
|
},
|
||||||
|
shim: {
|
||||||
|
"jquery.ui": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jquery.treeview": {
|
||||||
|
deps: ['jquery', 'jquery.cookie'],
|
||||||
|
exports: '$.fn.treeview'
|
||||||
|
},
|
||||||
|
bootstrap:{
|
||||||
|
deps: ['jquery']
|
||||||
|
},
|
||||||
|
"jquery.cookie": {
|
||||||
|
deps: ["jquery"],
|
||||||
|
exports: '$.fn.cookie'
|
||||||
|
},
|
||||||
|
"jquery.tooltip": {
|
||||||
|
deps: ["jquery"],
|
||||||
|
exports: '$.fn.tooltip'
|
||||||
|
},
|
||||||
|
"jquery.ui": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jquery.ui.widget": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jfu.fileupload": {
|
||||||
|
deps: ["jquery.ui.widget"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mocha.setup({
|
||||||
|
ui: "bdd",
|
||||||
|
ignoreLeaks: false,
|
||||||
|
globals: ['ab']
|
||||||
|
});
|
||||||
|
|
||||||
|
console = window.console || function () {};
|
||||||
|
|
||||||
|
window.notrack = true;
|
||||||
|
|
||||||
|
window.runMocha = function () {
|
||||||
|
if (window.mochaPhantomJS) {
|
||||||
|
mochaPhantomJS.run();
|
||||||
|
} else {
|
||||||
|
mocha.run();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
require([
|
||||||
|
'tests/specs/login/home'
|
||||||
|
], window.runMocha);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -1,72 +0,0 @@
|
|||||||
require.config({
|
|
||||||
baseUrl: "../../scripts",
|
|
||||||
paths: {
|
|
||||||
specs: "tests/specs",
|
|
||||||
chai: "../../tmp-assets/chai/chai",
|
|
||||||
fixtures: "../../tmp-assets/js-fixtures/fixtures",
|
|
||||||
jquery: "../assets/jquery/jquery",
|
|
||||||
jqueryui: "../assets/jquery.ui/jquery-ui",
|
|
||||||
backbone: "../assets/backbone-amd/backbone",
|
|
||||||
i18n: "../assets/i18next/i18next.amd-1.6.3",
|
|
||||||
bootstrap: "../assets/bootstrap/js/bootstrap.min",
|
|
||||||
sinonchai: "../../tmp-assets/sinon-chai/lib/sinon-chai",
|
|
||||||
squire: "../../tmp-assets/squire/src/Squire",
|
|
||||||
"jquery.ui": "../assets/jquery.ui/jquery-ui",
|
|
||||||
underscore: "../assets/underscore-amd/underscore",
|
|
||||||
"jquery.ui.widget": "../assets/jquery-file-upload/jquery.ui.widget",
|
|
||||||
"jquery.cookie": "../assets/jquery.cookie/jquery.cookie",
|
|
||||||
"jquery.treeview": "../assets/jquery.treeview/jquery.treeview",
|
|
||||||
"jquery.tooltip": "../assets/jquery.tooltip/jquery.tooltip",
|
|
||||||
"blueimp.loadimage" : "../assets/blueimp-load-image/load-image",
|
|
||||||
"jfu.iframe-transport": "../assets/jquery-file-upload/jquery.iframe-transport",
|
|
||||||
"jfu.fileupload": "../assets/jquery-file-upload/jquery.fileupload",
|
|
||||||
},
|
|
||||||
shim: {
|
|
||||||
jqueryui: {
|
|
||||||
deps: ["jquery"]
|
|
||||||
},
|
|
||||||
"jquery.treeview": {
|
|
||||||
deps: ['jquery', 'jquery.cookie'],
|
|
||||||
exports: '$.fn.treeview'
|
|
||||||
},
|
|
||||||
bootstrap:{
|
|
||||||
deps: ['jquery']
|
|
||||||
},
|
|
||||||
"jquery.cookie": {
|
|
||||||
deps: ["jquery"],
|
|
||||||
exports: '$.fn.cookie'
|
|
||||||
},
|
|
||||||
"jquery.tooltip": {
|
|
||||||
deps: ["jquery"],
|
|
||||||
exports: '$.fn.tooltip'
|
|
||||||
},
|
|
||||||
"jquery.ui": {
|
|
||||||
deps: ["jquery"]
|
|
||||||
},
|
|
||||||
"jquery.ui.widget": {
|
|
||||||
deps: ["jquery"]
|
|
||||||
},
|
|
||||||
"jfu.fileupload": {
|
|
||||||
deps: ["jquery.ui.widget"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mocha.setup({
|
|
||||||
ui: "bdd",
|
|
||||||
ignoreLeaks: true,
|
|
||||||
globals: ['js-fixtures']
|
|
||||||
});
|
|
||||||
|
|
||||||
console = window.console || function () {
|
|
||||||
};
|
|
||||||
|
|
||||||
window.notrack = true;
|
|
||||||
|
|
||||||
var runMocha = function () {
|
|
||||||
if (window.mochaPhantomJS) {
|
|
||||||
mochaPhantomJS.run();
|
|
||||||
} else {
|
|
||||||
mocha.run();
|
|
||||||
}
|
|
||||||
};
|
|
88
www/scripts/tests/model.html
Normal file
88
www/scripts/tests/model.html
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<title>Mocha Spec Runner</title>
|
||||||
|
<link rel="stylesheet" href="./../../../tmp-assets/mocha/mocha.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="mocha"></div>
|
||||||
|
<script src="./../../../tmp-assets/mocha/mocha.js"></script>
|
||||||
|
<script src="./../../../tmp-assets/sinonjs/sinon.js"></script>
|
||||||
|
<script src="../../assets/requirejs/require.js"></script>
|
||||||
|
<script>
|
||||||
|
require.config({
|
||||||
|
baseUrl: "../../scripts",
|
||||||
|
paths: {
|
||||||
|
"chai" : "../../tmp-assets/chai/chai",
|
||||||
|
"fixtures": "../../tmp-assets/js-fixtures/fixtures",
|
||||||
|
"jquery": "../assets/jquery/jquery",
|
||||||
|
"backbone": "../assets/backbone-amd/backbone",
|
||||||
|
"i18n": "../assets/i18next/i18next.amd-1.6.3",
|
||||||
|
"bootstrap": "../assets/bootstrap/js/bootstrap.min",
|
||||||
|
"sinonchai": "../../tmp-assets/sinon-chai/lib/sinon-chai",
|
||||||
|
"squire": "../../tmp-assets/squire/src/Squire",
|
||||||
|
"jquery.ui": "../assets/jquery.ui/jquery-ui",
|
||||||
|
"underscore": "../assets/underscore-amd/underscore",
|
||||||
|
"jquery.ui.widget": "../assets/jquery-file-upload/jquery.ui.widget",
|
||||||
|
"jquery.cookie": "../assets/jquery.cookie/jquery.cookie",
|
||||||
|
"jquery.treeview": "../assets/jquery.treeview/jquery.treeview",
|
||||||
|
"jquery.tooltip": "../assets/jquery.tooltip/jquery.tooltip",
|
||||||
|
"blueimp.loadimage" : "../assets/blueimp-load-image/load-image",
|
||||||
|
"jfu.iframe-transport": "../assets/jquery-file-upload/jquery.iframe-transport",
|
||||||
|
"jfu.fileupload": "../assets/jquery-file-upload/jquery.fileupload"
|
||||||
|
},
|
||||||
|
shim: {
|
||||||
|
"jquery.ui": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jquery.treeview": {
|
||||||
|
deps: ['jquery', 'jquery.cookie'],
|
||||||
|
exports: '$.fn.treeview'
|
||||||
|
},
|
||||||
|
bootstrap:{
|
||||||
|
deps: ['jquery']
|
||||||
|
},
|
||||||
|
"jquery.cookie": {
|
||||||
|
deps: ["jquery"],
|
||||||
|
exports: '$.fn.cookie'
|
||||||
|
},
|
||||||
|
"jquery.tooltip": {
|
||||||
|
deps: ["jquery"],
|
||||||
|
exports: '$.fn.tooltip'
|
||||||
|
},
|
||||||
|
"jquery.ui": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jquery.ui.widget": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jfu.fileupload": {
|
||||||
|
deps: ["jquery.ui.widget"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mocha.setup({
|
||||||
|
ui: "bdd",
|
||||||
|
ignoreLeaks: false,
|
||||||
|
globals: ['ab']
|
||||||
|
});
|
||||||
|
|
||||||
|
console = window.console || function () {};
|
||||||
|
|
||||||
|
window.notrack = true;
|
||||||
|
|
||||||
|
window.runMocha = function () {
|
||||||
|
if (window.mochaPhantomJS) {
|
||||||
|
mochaPhantomJS.run();
|
||||||
|
} else {
|
||||||
|
mocha.run();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
require([
|
||||||
|
'tests/specs/models'
|
||||||
|
], window.runMocha);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -2,18 +2,16 @@ define([
|
|||||||
'chai',
|
'chai',
|
||||||
'fixtures',
|
'fixtures',
|
||||||
'jquery',
|
'jquery',
|
||||||
'squire',
|
|
||||||
'apps/admin/main/app',
|
'apps/admin/main/app',
|
||||||
'apps/admin/main/views/leftPanel',
|
'apps/admin/main/views/leftPanel',
|
||||||
'apps/admin/main/views/rightPanel'
|
'apps/admin/main/views/rightPanel'
|
||||||
], function (chai, fixtures, $, Squire, App, LeftPanel, RightPanel) {
|
], function (chai, fixtures, $, App, LeftPanel, RightPanel) {
|
||||||
var expect = chai.expect;
|
var expect = chai.expect;
|
||||||
var assert = chai.assert;
|
var assert = chai.assert;
|
||||||
var should = chai.should();
|
var should = chai.should();
|
||||||
|
|
||||||
fixtures.path = 'fixtures';
|
fixtures.path = 'fixtures';
|
||||||
$("body").append(fixtures.read('admin/main/left-panel.html'));
|
$("body").append(fixtures.read('admin/main/left-panel.html'));
|
||||||
$("right-view").append(fixtures.read('admin/main/right-panel.html'));
|
|
||||||
|
|
||||||
App.create();
|
App.create();
|
||||||
|
|
||||||
@@ -25,6 +23,14 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Views", function () {
|
describe("Views", function () {
|
||||||
|
beforeEach(function() {
|
||||||
|
this.xhr = sinon.useFakeXMLHttpRequest();
|
||||||
|
this.server = sinon.fakeServer.create();
|
||||||
|
});
|
||||||
|
afterEach(function() {
|
||||||
|
this.xhr.restore();
|
||||||
|
this.server.restore();
|
||||||
|
});
|
||||||
describe("leftView", function () {
|
describe("leftView", function () {
|
||||||
it("should throw an exception if 'event manager' is missing", function () {
|
it("should throw an exception if 'event manager' is missing", function () {
|
||||||
expect(function () {
|
expect(function () {
|
||||||
@@ -37,28 +43,23 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should make ajax request if we reload", function () {
|
it("should make ajax request if we reload", function () {
|
||||||
var xhr = sinon.useFakeXMLHttpRequest();
|
|
||||||
var requests = [];
|
var requests = [];
|
||||||
xhr.onCreate = function (req) { requests.push(req); };
|
this.xhr.onCreate = function (req) { requests.push(req); };
|
||||||
|
|
||||||
var leftP = new LeftPanel({eventManager : AdminApp.eventManager, treeUrl: "/admin/tree/"});
|
var leftP = new LeftPanel({eventManager : AdminApp.eventManager, treeUrl: "/admin/tree/"});
|
||||||
leftP.reloadTree();
|
leftP.reloadTree();
|
||||||
|
|
||||||
assert.equal(requests.length, 1);
|
assert.equal(requests.length, 1);
|
||||||
assert.equal(requests[0].url, "/admin/tree/");
|
assert.equal(requests[0].url, "/admin/tree/");
|
||||||
|
|
||||||
xhr.restore();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should make ajax request if we click link", function () {
|
it("should make ajax request if we click link", function () {
|
||||||
var xhr = sinon.useFakeXMLHttpRequest();
|
|
||||||
var requests = [];
|
var requests = [];
|
||||||
xhr.onCreate = function (req) { requests.push(req); };
|
this.xhr.onCreate = function (req) { requests.push(req); };
|
||||||
|
|
||||||
var leftP = new LeftPanel({eventManager : AdminApp.eventManager, el:$(".left-view"), treeUrl: "toto"});
|
var leftP = new LeftPanel({eventManager : AdminApp.eventManager, el:$(".left-view"), treeUrl: "toto"});
|
||||||
leftP.$('a[target=right]:first').trigger("click");
|
leftP.$('a[target=right]:first').trigger("click");
|
||||||
assert.equal(requests.length, 1);
|
assert.ok(requests.length > 0);
|
||||||
xhr.restore();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("triggers right view", function () {
|
it("triggers right view", function () {
|
||||||
@@ -67,18 +68,15 @@ define([
|
|||||||
trigger = true;
|
trigger = true;
|
||||||
});
|
});
|
||||||
var leftP = new LeftPanel({eventManager : AdminApp.eventManager, el:$(".left-view"), treeUrl: "toto"});
|
var leftP = new LeftPanel({eventManager : AdminApp.eventManager, el:$(".left-view"), treeUrl: "toto"});
|
||||||
var rightP = new RightPanel({eventManager : AdminApp.eventManager, el:$(".right-view")});
|
|
||||||
var server = sinon.fakeServer.create();
|
|
||||||
leftP.activeTree();
|
leftP.activeTree();
|
||||||
leftP.$('a[target=right]:first').trigger("click");
|
leftP.$('a[target=right]:first').trigger("click");
|
||||||
server.requests[0].respond(
|
this.server.requests[0].respond(
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(trigger);
|
assert.ok(trigger);
|
||||||
server.restore();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -90,14 +88,21 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should make ajax request if we click link", function () {
|
it("should make ajax request if we click link", function () {
|
||||||
var xhr = sinon.useFakeXMLHttpRequest();
|
|
||||||
var requests = [];
|
var requests = [];
|
||||||
xhr.onCreate = function (req) { requests.push(req); };
|
this.xhr.onCreate = function (req) { requests.push(req); };
|
||||||
|
$(".right-view").html('<a href="toto">test</a>');
|
||||||
var rightP = new RightPanel({eventManager : AdminApp.eventManager, el:$(".right-view")});
|
var rightP = new RightPanel({eventManager : AdminApp.eventManager, el:$(".right-view")});
|
||||||
rightP.$('a:not(.no-ajax)').trigger("click");
|
rightP.$('a').trigger('click');
|
||||||
assert.equal(requests.length, 1);
|
assert.ok(requests.length > 0);
|
||||||
xhr.restore();
|
});
|
||||||
|
|
||||||
|
it("should make ajax request if we click form", function () {
|
||||||
|
var requests = [];
|
||||||
|
this.xhr.onCreate = function (req) { requests.push(req); };
|
||||||
|
$(".right-view").html('<form method="POST" action="toto"></form>');
|
||||||
|
var rightP = new RightPanel({eventManager : AdminApp.eventManager, el:$(".right-view")});
|
||||||
|
rightP.$('form:first').trigger('submit');
|
||||||
|
assert.ok(requests.length > 0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -56,7 +56,7 @@ define([
|
|||||||
this.collection = new TaskCollection([]);
|
this.collection = new TaskCollection([]);
|
||||||
this.view = new TasksView({
|
this.view = new TasksView({
|
||||||
collection: this.collection,
|
collection: this.collection,
|
||||||
el: AdminFieldApp.$tasksListView
|
el: TaskManagerApp.$tasksListView
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ define([
|
|||||||
|
|
||||||
this.view = new TasksView({
|
this.view = new TasksView({
|
||||||
collection: this.collection,
|
collection: this.collection,
|
||||||
el: AdminFieldApp.$tasksListView
|
el: TaskManagerApp.$tasksListView
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -84,5 +84,3 @@ define([
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@@ -9,50 +9,65 @@ define([
|
|||||||
var should = chai.should();
|
var should = chai.should();
|
||||||
chai.use(sinonchai);
|
chai.use(sinonchai);
|
||||||
|
|
||||||
describe("SubscriberManager", function () {
|
(function () {
|
||||||
var i;
|
describe("SubscriberManager", function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
var $this = this;
|
var $this = this;
|
||||||
$this.connection = {};
|
$this.connection = {};
|
||||||
$this.connection.subscribe = sinon.spy();
|
$this.connection.subscribe = sinon.spy();
|
||||||
$this.connection.unsubscribe = sinon.spy();
|
$this.connection.unsubscribe = sinon.spy();
|
||||||
$this.injector = new Squire();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should call subscribe", function () {
|
});
|
||||||
var $this = this;
|
|
||||||
$this.injector.mock(
|
it("should call subscribe", function () {
|
||||||
["common/websockets/connection"], $this.connection
|
var $this = this;
|
||||||
).require(['common/websockets/subscriberManager'], function(manager) {
|
var injector = new Squire();
|
||||||
manager.register('topic');
|
injector.mock(
|
||||||
expect($this.connection.subscribe.should.have.callCount(1)).to.be.ok;
|
["common/websockets/connection"], $this.connection
|
||||||
assert.ok(manager.hasCallbacks());
|
).require(['common/websockets/subscriberManager'], function(manager) {
|
||||||
|
manager.register('topic');
|
||||||
|
expect($this.connection.subscribe.should.have.callCount(1)).to.be.ok;
|
||||||
|
assert.ok(manager.hasCallbacks());
|
||||||
|
});
|
||||||
|
|
||||||
|
try{
|
||||||
|
injector.remove();
|
||||||
|
} catch(e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should call unsubscribe", function () {
|
||||||
|
var $this = this;
|
||||||
|
var injector = new Squire();
|
||||||
|
injector.mock(
|
||||||
|
["common/websockets/connection"], $this.connection
|
||||||
|
).require(['common/websockets/subscriberManager'], function(manager) {
|
||||||
|
manager.register('topic');
|
||||||
|
manager.unregister();
|
||||||
|
expect($this.connection.unsubscribe.should.have.callCount(1)).to.be.ok;
|
||||||
|
assert.ok(!manager.hasCallbacks());
|
||||||
|
});
|
||||||
|
try{
|
||||||
|
injector.remove();
|
||||||
|
} catch(e) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should add callbacks", function () {
|
||||||
|
var $this = this;
|
||||||
|
var injector = new Squire();
|
||||||
|
injector.mock(
|
||||||
|
["common/websockets/connection"], $this.connection
|
||||||
|
).require(['common/websockets/subscriberManager'], function(manager) {
|
||||||
|
assert.ok(!manager.hasCallbacks());
|
||||||
|
manager.pushCallback(function(){return null;});
|
||||||
|
assert.ok(manager.hasCallbacks());
|
||||||
|
});
|
||||||
|
try{
|
||||||
|
injector.remove();
|
||||||
|
} catch(e) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
})();
|
||||||
it("should call unsubscribe", function () {
|
|
||||||
var $this = this;
|
|
||||||
$this.injector.mock(
|
|
||||||
["common/websockets/connection"], $this.connection
|
|
||||||
).require(['common/websockets/subscriberManager'], function(manager) {
|
|
||||||
manager.register('topic');
|
|
||||||
manager.unregister();
|
|
||||||
expect($this.connection.unsubscribe.should.have.callCount(1)).to.be.ok;
|
|
||||||
assert.ok(!manager.hasCallbacks());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should add callbacks", function () {
|
|
||||||
var $this = this;
|
|
||||||
$this.injector.mock(
|
|
||||||
["common/websockets/connection"], $this.connection
|
|
||||||
).require(['common/websockets/subscriberManager'], function(manager) {
|
|
||||||
assert.ok(!manager.hasCallbacks());
|
|
||||||
manager.pushCallback(function(){return null;});
|
|
||||||
assert.ok(manager.hasCallbacks());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
88
www/scripts/tests/validator.html
Normal file
88
www/scripts/tests/validator.html
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<title>Mocha Spec Runner</title>
|
||||||
|
<link rel="stylesheet" href="./../../../tmp-assets/mocha/mocha.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="mocha"></div>
|
||||||
|
<script src="./../../../tmp-assets/mocha/mocha.js"></script>
|
||||||
|
<script src="./../../../tmp-assets/sinonjs/sinon.js"></script>
|
||||||
|
<script src="../../assets/requirejs/require.js"></script>
|
||||||
|
<script>
|
||||||
|
require.config({
|
||||||
|
baseUrl: "../../scripts",
|
||||||
|
paths: {
|
||||||
|
"chai" : "../../tmp-assets/chai/chai",
|
||||||
|
"fixtures": "../../tmp-assets/js-fixtures/fixtures",
|
||||||
|
"jquery": "../assets/jquery/jquery",
|
||||||
|
"backbone": "../assets/backbone-amd/backbone",
|
||||||
|
"i18n": "../assets/i18next/i18next.amd-1.6.3",
|
||||||
|
"bootstrap": "../assets/bootstrap/js/bootstrap.min",
|
||||||
|
"sinonchai": "../../tmp-assets/sinon-chai/lib/sinon-chai",
|
||||||
|
"squire": "../../tmp-assets/squire/src/Squire",
|
||||||
|
"jquery.ui": "../assets/jquery.ui/jquery-ui",
|
||||||
|
"underscore": "../assets/underscore-amd/underscore",
|
||||||
|
"jquery.ui.widget": "../assets/jquery-file-upload/jquery.ui.widget",
|
||||||
|
"jquery.cookie": "../assets/jquery.cookie/jquery.cookie",
|
||||||
|
"jquery.treeview": "../assets/jquery.treeview/jquery.treeview",
|
||||||
|
"jquery.tooltip": "../assets/jquery.tooltip/jquery.tooltip",
|
||||||
|
"blueimp.loadimage" : "../assets/blueimp-load-image/load-image",
|
||||||
|
"jfu.iframe-transport": "../assets/jquery-file-upload/jquery.iframe-transport",
|
||||||
|
"jfu.fileupload": "../assets/jquery-file-upload/jquery.fileupload"
|
||||||
|
},
|
||||||
|
shim: {
|
||||||
|
"jquery.ui": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jquery.treeview": {
|
||||||
|
deps: ['jquery', 'jquery.cookie'],
|
||||||
|
exports: '$.fn.treeview'
|
||||||
|
},
|
||||||
|
bootstrap:{
|
||||||
|
deps: ['jquery']
|
||||||
|
},
|
||||||
|
"jquery.cookie": {
|
||||||
|
deps: ["jquery"],
|
||||||
|
exports: '$.fn.cookie'
|
||||||
|
},
|
||||||
|
"jquery.tooltip": {
|
||||||
|
deps: ["jquery"],
|
||||||
|
exports: '$.fn.tooltip'
|
||||||
|
},
|
||||||
|
"jquery.ui": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jquery.ui.widget": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jfu.fileupload": {
|
||||||
|
deps: ["jquery.ui.widget"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mocha.setup({
|
||||||
|
ui: "bdd",
|
||||||
|
ignoreLeaks: false,
|
||||||
|
globals: ['ab']
|
||||||
|
});
|
||||||
|
|
||||||
|
console = window.console || function () {};
|
||||||
|
|
||||||
|
window.notrack = true;
|
||||||
|
|
||||||
|
window.runMocha = function () {
|
||||||
|
if (window.mochaPhantomJS) {
|
||||||
|
mochaPhantomJS.run();
|
||||||
|
} else {
|
||||||
|
mocha.run();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
require([
|
||||||
|
'tests/specs/validator'
|
||||||
|
], window.runMocha);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
89
www/scripts/tests/websocket.html
Normal file
89
www/scripts/tests/websocket.html
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<title>Mocha Spec Runner</title>
|
||||||
|
<link rel="stylesheet" href="./../../../tmp-assets/mocha/mocha.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="mocha"></div>
|
||||||
|
<script src="./../../../tmp-assets/mocha/mocha.js"></script>
|
||||||
|
<script src="./../../../tmp-assets/sinonjs/sinon.js"></script>
|
||||||
|
<script src="../../assets/requirejs/require.js"></script>
|
||||||
|
<script>
|
||||||
|
require.config({
|
||||||
|
baseUrl: "../../scripts",
|
||||||
|
paths: {
|
||||||
|
"chai" : "../../tmp-assets/chai/chai",
|
||||||
|
"fixtures": "../../tmp-assets/js-fixtures/fixtures",
|
||||||
|
"jquery": "../assets/jquery/jquery",
|
||||||
|
"backbone": "../assets/backbone-amd/backbone",
|
||||||
|
"i18n": "../assets/i18next/i18next.amd-1.6.3",
|
||||||
|
"bootstrap": "../assets/bootstrap/js/bootstrap.min",
|
||||||
|
"sinonchai": "../../tmp-assets/sinon-chai/lib/sinon-chai",
|
||||||
|
"squire": "../../tmp-assets/squire/src/Squire",
|
||||||
|
"jquery.ui": "../assets/jquery.ui/jquery-ui",
|
||||||
|
"underscore": "../assets/underscore-amd/underscore",
|
||||||
|
"jquery.ui.widget": "../assets/jquery-file-upload/jquery.ui.widget",
|
||||||
|
"jquery.cookie": "../assets/jquery.cookie/jquery.cookie",
|
||||||
|
"jquery.treeview": "../assets/jquery.treeview/jquery.treeview",
|
||||||
|
"jquery.tooltip": "../assets/jquery.tooltip/jquery.tooltip",
|
||||||
|
"blueimp.loadimage" : "../assets/blueimp-load-image/load-image",
|
||||||
|
"jfu.iframe-transport": "../assets/jquery-file-upload/jquery.iframe-transport",
|
||||||
|
"jfu.fileupload": "../assets/jquery-file-upload/jquery.fileupload"
|
||||||
|
},
|
||||||
|
shim: {
|
||||||
|
"jquery.ui": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jquery.treeview": {
|
||||||
|
deps: ['jquery', 'jquery.cookie'],
|
||||||
|
exports: '$.fn.treeview'
|
||||||
|
},
|
||||||
|
bootstrap:{
|
||||||
|
deps: ['jquery']
|
||||||
|
},
|
||||||
|
"jquery.cookie": {
|
||||||
|
deps: ["jquery"],
|
||||||
|
exports: '$.fn.cookie'
|
||||||
|
},
|
||||||
|
"jquery.tooltip": {
|
||||||
|
deps: ["jquery"],
|
||||||
|
exports: '$.fn.tooltip'
|
||||||
|
},
|
||||||
|
"jquery.ui": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jquery.ui.widget": {
|
||||||
|
deps: ["jquery"]
|
||||||
|
},
|
||||||
|
"jfu.fileupload": {
|
||||||
|
deps: ["jquery.ui.widget"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mocha.setup({
|
||||||
|
ui: "bdd",
|
||||||
|
ignoreLeaks: false,
|
||||||
|
globals: ['ab']
|
||||||
|
});
|
||||||
|
|
||||||
|
console = window.console || function () {};
|
||||||
|
|
||||||
|
window.notrack = true;
|
||||||
|
|
||||||
|
window.runMocha = function () {
|
||||||
|
if (window.mochaPhantomJS) {
|
||||||
|
mochaPhantomJS.run();
|
||||||
|
} else {
|
||||||
|
mocha.run();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
require([
|
||||||
|
'tests/specs/websockets/connection',
|
||||||
|
'tests/specs/websockets/subscriberManager'
|
||||||
|
], window.runMocha);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Reference in New Issue
Block a user