Skip to content
Permalink
Browse files

Updated spaces.

  • Loading branch information...
robbz committed Mar 13, 2013
1 parent a12ddda commit 0dcab9a258a984fa414bdc0d0fa1e40ebd287eca
Showing with 49 additions and 49 deletions.
  1. +49 −49 test/loadTests.js
@@ -1,50 +1,50 @@
suite('load', function(){
beforeEach(function(){
beforeEach(function(){
$('body').append('<div id="user"></div>');
fx.user = null; // Reset the user loaded from the js file.
});

afterEach(function() {
$('#user').remove();
$('#user').remove();
});

test('loads an exisiting url', function(done){
test('loads an exisiting url', function(done){
fx.load([{ url: '/test/components/user/js', type: 'js' }], null, function(err) {
expect(err).to.be(null);
done();
expect(err).to.be(null);
done();
});
});
test('returns a 404 if the url does not exist', function(done){
fx.load([{ url: '/idonotexist/js', type: 'js' }], null, function(err) {
expect(err).not.to.be(null);
expect(err.status).to.be(404);
done();
expect(err).not.to.be(null);
expect(err.status).to.be(404);
done();
});
});
test('executes a js result', function(done){
fx.user = undefined;
fx.user = undefined;
fx.load([{ url: '/test/components/user/js', type: 'js' }], null, function() {
expect(fx.user).not.to.be(undefined);
done();
expect(fx.user).not.to.be(undefined);
done();
});
});
test('applies a css result', function(done){
fx.load([{ url: '/test/components/user/css', type: 'css' }], null, function() {
expect($('#user').width()).to.be(100);
done();
expect($('#user').width()).to.be(100);
done();
});
});
test('appends the loaded html to a given html-element', function(done){
fx.load([{ url: '/test/components/user/html', type: 'html' }], { container: '#user' }, function() {
expect($('#user').html()).not.to.be('');
done();
expect($('#user').html()).not.to.be('');
done();
});
});
test('appends the loaded html to the body', function(done){
fx.load([{ url: '/test/components/user/html', type: 'html' }], {}, function() {
expect($('#user').html()).to.be('');
expect($('.test-user').length).to.be.greaterThan(0);
done();
expect($('#user').html()).to.be('');
expect($('.test-user').length).to.be.greaterThan(0);
done();
});
});
test('loads the entire js if no path is given', function(done){
@@ -97,43 +97,43 @@ suite('load', function(){
});

suite("query", function() {
var query;
var query;

beforeEach(function() {
query = fx.query();
});
beforeEach(function() {
query = fx.query();
});

test("creates a query-object", function() {
expect(query.hasOwnProperty('add')).to.be(true);
expect(query.hasOwnProperty('run')).to.be(true);
});

suite("add", function() {
test("fills the query", function() {
var component = { url: '/idonotexist1/js', type: 'css' };
query.add(component);
expect(query.isEmpty()).to.be(false);
});
test("prevents from adding the same item two times", function() {
var component = { url: '/idonotexist1/js', type: 'css' };
query.add(component);
query.add(component);
expect(query.length()).to.be(1);
});
});
suite("add", function() {
test("fills the query", function() {
var component = { url: '/idonotexist1/js', type: 'css' };
query.add(component);
expect(query.isEmpty()).to.be(false);
});
test("prevents from adding the same item two times", function() {
var component = { url: '/idonotexist1/js', type: 'css' };
query.add(component);
query.add(component);
expect(query.length()).to.be(1);
});
});

suite("run", function() {
test("runs the query", function(done) {
query.run(query, function() {
done();
});
});
test("returns an error if the url does not exist", function(done) {
query.add({url: '/idonotexist2/js', type: 'js' });
query.run(null, function(err) {
expect(err).to.not.be(null);
done();
});
});
});
suite("run", function() {
test("runs the query", function(done) {
query.run(query, function() {
done();
});
});
test("returns an error if the url does not exist", function(done) {
query.add({url: '/idonotexist2/js', type: 'js' });
query.run(null, function(err) {
expect(err).to.not.be(null);
done();
});
});
});
});

0 comments on commit 0dcab9a

Please sign in to comment.
You can’t perform that action at this time.