Commit 2223459b authored by Romain Courteaud's avatar Romain Courteaud

Add test for gadget_erp5_page_slap_load_schema.html

parent e1bc6481
renderjs.js
rsvp.js
jio.js
tv4.js
node_modules/
npm-debug.log
......@@ -46,7 +46,7 @@ module.exports = function (grunt) {
}
},
test: {
src: ['test/jsonform_test.js'],
src: ['test/jsonform_test.js', 'test/schema_test.js'],
directives: {
maxlen: 79,
indent: 2,
......@@ -64,7 +64,8 @@ module.exports = function (grunt) {
}
},
client: {
src: ['gadget_json_generated_form.js'],
src: ['gadget_json_generated_form.js',
'gadget_erp5_page_slap_load_schema.js'],
directives: {
maxlen: 79,
indent: 2,
......@@ -87,6 +88,12 @@ module.exports = function (grunt) {
}, {
src: 'node_modules/renderjs/dist/renderjs-latest.js',
dest: "renderjs.js"
}, {
src: 'node_modules/jio/dist/jio-latest.js',
dest: "jio.js"
}, {
src: 'node_modules/tv4/tv4.js',
dest: "tv4.js"
}]
}
},
......
......@@ -9,7 +9,7 @@
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="tv4.min.js" type="text/javascript"></script>
<script src="tv4.js" type="text/javascript"></script>
<script src="jio.js" type="text/javascript"></script>
<script src="gadget_erp5_page_slap_load_schema.js" type="text/javascript"></script>
</head>
......
......@@ -5,7 +5,9 @@
"main": "dist/json-form-latest.js",
"dependencies": {
"rsvp": "git+https://lab.nexedi.com/nexedi/rsvp.js.git",
"renderjs": "git+https://lab.nexedi.com/nexedi/renderjs.git"
"renderjs": "git+https://lab.nexedi.com/nexedi/renderjs.git",
"jio": "git+https://lab.nexedi.com/nexedi/jio.git",
"tv4": "1.3.0"
},
"devDependencies": {
"connect-livereload": "~0.3.0",
......
......@@ -9,6 +9,7 @@
<script src="../renderjs.js" type="text/javascript"></script>
<script src="../node_modules/grunt-contrib-qunit/test/libs/qunit.js" type="text/javascript"></script>
<script src="../node_modules/sinon/pkg/sinon.js" type="text/javascript"></script>
<script src="schema_test.js" type="text/javascript"></script>
<script src="jsonform_test.js" type="text/javascript"></script>
</head>
<body>
......
/*jslint nomen: true*/
/*global console*/
(function (document, renderJS, QUnit) {
"use strict";
var test = QUnit.test,
stop = QUnit.stop,
start = QUnit.start,
ok = QUnit.ok,
expect = QUnit.expect,
// equal = QUnit.equal,
// throws = QUnit.throws,
// deepEqual = QUnit.deepEqual,
module = QUnit.module,
// notEqual = QUnit.notEqual,
root_gadget_defer = RSVP.defer(),
jsonform_url = '../gadget_erp5_page_slap_load_schema.html';
// Keep track of the root gadget
renderJS(window)
.ready(function () {
root_gadget_defer.resolve(this);
});
/////////////////////////////////////////////////////////////////
// declareGadget
/////////////////////////////////////////////////////////////////
module("schema.declareGadget", {
setup: function () {
renderJS.clearGadgetKlassList();
}
});
test('JSON Schema gadget can be loaded', function () {
stop();
expect(1);
root_gadget_defer.promise
.then(function (root_gadget) {
return root_gadget.declareGadget(
jsonform_url,
{
sandbox: 'iframe',
element: document.querySelector('#qunit-fixture')
}
);
})
.then(function (gadget) {
ok(true, gadget);
})
.fail(function (error) {
ok(false, error);
console.warn(error);
throw error;
})
.always(function () {
start();
});
});
}(document, renderJS, QUnit));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment