prepare 0.3.0, moved example to main package.json and move
options.error/debug to options.boot
This commit is contained in:
parent
a9798d05b6
commit
7b94313f90
11 changed files with 208 additions and 122 deletions
|
|
@ -3,31 +3,46 @@ define(['es5-ff-spa-loader'], function(FFSpaLoader) {
|
|||
'use strict';
|
||||
|
||||
describe('Start loader', function() {
|
||||
beforeEach(function () {
|
||||
function emptyElement(element) {
|
||||
var myNode = element;
|
||||
while (myNode.firstChild) {
|
||||
myNode.removeChild(myNode.firstChild);
|
||||
}
|
||||
}
|
||||
emptyElement(document.head);
|
||||
emptyElement(document.body);
|
||||
});
|
||||
it('FFSpaLoader start with error', function(done) {
|
||||
FFSpaLoader.options.server.url = 'http://localhost:9999';
|
||||
FFSpaLoader.options.error.handler = function(err) {
|
||||
done();
|
||||
};
|
||||
FFSpaLoader.start();
|
||||
FFSpaLoader.start(function(err) {
|
||||
if (err !== null) {
|
||||
done();
|
||||
} else {
|
||||
fail();
|
||||
}
|
||||
});
|
||||
});
|
||||
it('FFSpaLoader starts', function(done) {
|
||||
FFSpaLoader.options.server.url = 'http://localhost:9090/test';
|
||||
FFSpaLoader.options.server.assets = '/static/spa-client-resources';
|
||||
FFSpaLoader.options.error.handler = function(err) {
|
||||
fail(); // TIODI
|
||||
};
|
||||
FFSpaLoader.start(function() {
|
||||
done();
|
||||
FFSpaLoader.start(function(err) {
|
||||
if (err !== null) {
|
||||
fail();
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
it('FFSpaLoader starts again', function(done) {
|
||||
FFSpaLoader.options.server.url = 'http://localhost:9090/test';
|
||||
FFSpaLoader.options.server.assets = '/static/spa-client-resources';
|
||||
FFSpaLoader.options.error.handler = function(err) {
|
||||
fail(); // TIODI
|
||||
};
|
||||
FFSpaLoader.start(function() {
|
||||
done();
|
||||
FFSpaLoader.start(function(err) {
|
||||
if (err !== null) {
|
||||
fail();
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
42
test/spec/test-cache.js
Normal file
42
test/spec/test-cache.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
define(['es5-ff-spa-loader'], function(FFSpaLoader) {
|
||||
'use strict';
|
||||
|
||||
describe('Test Cache', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
afterEach(function() {
|
||||
jasmine.Ajax.uninstall();
|
||||
});
|
||||
|
||||
it('FFSpaLoader boot ', function(done) {
|
||||
var clientResource = {
|
||||
data: {
|
||||
resources: [{
|
||||
url: '/static/js/foobar.js',
|
||||
type: 'js',
|
||||
hash: 12381273
|
||||
}]
|
||||
}
|
||||
};
|
||||
jasmine.Ajax.stubRequest('http://localhost:999/static/spa-client-resources').andReturn({
|
||||
'responseText': JSON.stringify(clientResource)
|
||||
});
|
||||
jasmine.Ajax.stubRequest('http://localhost:999/static/js/foobar.js').andReturn({
|
||||
'responseText': '\nvar FOOBAR = \'loaded\';\n'
|
||||
});
|
||||
//FFSpaLoader.options.boot.debug.enable = true;
|
||||
FFSpaLoader.options.server.url = 'http://localhost:999';
|
||||
FFSpaLoader.options.server.assets = '/static/spa-client-resources';
|
||||
FFSpaLoader.start(function(err) {
|
||||
if (err !== null) {
|
||||
fail();
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue