Skip to content
This repository was archived by the owner on Jun 9, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# FruitMachine [![Build Status](https://travis-ci.org/ftlabs/fruitmachine.svg?branch=master)](https://travis-ci.org/ftlabs/fruitmachine)
# FruitMachine [![Build Status](https://travis-ci.org/ftlabs/fruitmachine.svg?branch=master)](https://travis-ci.org/ftlabs/fruitmachine) [![Coverage Status](https://coveralls.io/repos/ftlabs/fruitmachine/badge.png?branch=master)](https://coveralls.io/r/ftlabs/fruitmachine?branch=master) [![Dependency Status](https://gemnasium.com/ftlabs/fruitmachine.png)](https://gemnasium.com/ftlabs/fruitmachine)

A lightweight component layout engine for client and server.

Expand Down Expand Up @@ -91,6 +91,10 @@ $ node_modules/.bin/buster-static
- **Wilson Page** - [@wilsonpage](http://github.com/wilsonpage)
- **Matt Andrews** - [@matthew-andrews](http://github.com/matthew-andrews)

## License
Copyright (c) 2014 The Financial Times Limited
Licensed under the MIT license.

## Credits and collaboration

The lead developer of FruitMachine is [Wilson Page](http://github.com/wilsonpage) at FT Labs. All open source code released by FT Labs is licenced under the MIT licence. We welcome comments, feedback and suggestions. Please feel free to raise an issue or pull request.
11 changes: 7 additions & 4 deletions docs/templates/readme.hogan
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# {{pkg.title}} [![Build Status](https://travis-ci.org/ftlabs/fruitmachine.svg?branch=master)](https://travis-ci.org/ftlabs/fruitmachine)
# {{pkg.title}} [![Build Status](https://travis-ci.org/ftlabs/fruitmachine.svg?branch=master)](https://travis-ci.org/ftlabs/fruitmachine) [![Coverage Status](https://coveralls.io/repos/ftlabs/fruitmachine/badge.png?branch=master)](https://coveralls.io/r/ftlabs/fruitmachine?branch=master) [![Dependency Status](https://gemnasium.com/ftlabs/fruitmachine.png)](https://gemnasium.com/ftlabs/fruitmachine)

{{pkg.description}}

Expand Down Expand Up @@ -35,10 +35,9 @@ $ bower install fruitmachine

or

Download the [production version][min] (~2k gzipped) or the [development version][max].
Download the [pre-built version][built] (~2k gzipped).

[min]: http://github.com/ftlabs/fruitmachine/raw/master/build/fruitmachine.min.js
[max]: http://github.com/ftlabs/fruitmachine/raw/master/build/fruitmachine.js
[built]: http://wzrd.in/standalone/fruitmachine@latest

## Examples

Expand Down Expand Up @@ -95,6 +94,10 @@ $ node_modules/.bin/buster-static
- **{{name}}** - [@{{github}}](http://github.com/{{github}})
{{/pkg.contributors}}

## License
Copyright (c) 2014 {{pkg.organization}}
Licensed under the MIT license.

## Credits and collaboration

The lead developer of {{pkg.title}} is [Wilson Page](http://github.com/wilsonpage) at FT Labs. All open source code released by FT Labs is licenced under the MIT licence. We welcome comments, feedback and suggestions. Please feel free to raise an issue or pull request.
2 changes: 1 addition & 1 deletion lib/fruitmachine.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var mod = require('./module');
var define = require('./define');
var utils = require('utils');
var events = require('event');
var events = require('evt');

/**
* Creates a fruitmachine
Expand Down
2 changes: 1 addition & 1 deletion lib/module/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Module Dependencies
*/

var events = require('event');
var events = require('evt');

/**
* Local vars
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@
"coveralls": "cat coverage/lcov.info | coveralls"
},
"dependencies": {
"event": "git://github.com/wilsonpage/event.git",
"evt": "git://github.com/wilsonpage/evt.git",
"model": "git://github.com/wilsonpage/model.git",
"utils": "git://github.com/wilsonpage/utils.git",
"extend": "git://github.com/wilsonpage/extend.git"
},
"devDependencies": {
"hogan.js": "^2.0.0",
"buster": "~0.6.6",
"buster": "~0.7.8",
"grunt": "~0.4.1",
"grunt-cli": "~0.1.8",
"grunt-contrib-watch": "~0.5.1",
"grunt-contrib-uglify": "~0.2.2",
"grunt-readme": "git://github.com/wilsonpage/grunt-readme.git",
"grunt-version": "git://github.com/wilsonpage/grunt-version.git",
"grunt-browserify": "1.2.2",
"grunt-buster": "~0.2.1",
"backbone": "~1.0.0",
"express": "^3.3.4",
"grunt-browserify": "1.3.0",
"grunt-buster": "~0.3.1",
"backbone": "~1.1.0",
"express": "^3.4.8",
"grunt-istanbul": "~0.2.1",
"buster-istanbul": "~0.1.8",
"coveralls": "^2.1.0",
"buster-istanbul": "~0.1.10",
"coveralls": "^2.6.0",
"phantomjs": "~1.9.1-0"
},
"keywords": [],
Expand Down
4 changes: 3 additions & 1 deletion test/tests/define.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var assert = buster.assertions.assert;
var refute = buster.assertions.refute;

buster.testCase('fruitmachine.define()', {
setUp: function() {},
Expand Down Expand Up @@ -73,4 +75,4 @@ buster.testCase('fruitmachine.define()', {
delete fruitmachine.modules['my-module-1'];
delete fruitmachine.modules['my-module-2'];
}
});
});
4 changes: 3 additions & 1 deletion test/tests/helpers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var assert = buster.assertions.assert;

buster.testCase('fruitmachine#helpers()', {
setUp: function() {
var helper = this.helper = function(view) {
Expand Down Expand Up @@ -71,4 +73,4 @@ buster.testCase('fruitmachine#helpers()', {
this.spys.teardown.restore();
this.spys.destroy.restore();
}
});
});
4 changes: 3 additions & 1 deletion test/tests/module._getEl.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var assert = buster.assertions.assert;
var refute = buster.assertions.refute;

buster.testCase('View#_getEl()', {
"setUp": helpers.createView,
Expand Down Expand Up @@ -54,4 +56,4 @@ buster.testCase('View#_getEl()', {
},

"tearDown": helpers.destroyView
});
});
4 changes: 2 additions & 2 deletions test/tests/module._setEl.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var assert = buster.assertions.assert;

buster.testCase('View#_setEl()', {

Expand All @@ -20,12 +21,11 @@ buster.testCase('View#_setEl()', {

var apple = layout.module('apple');
var orange = layout.module('orange');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't used.

var original = orange.el;
var replacement = document.createElement('div');

orange._setEl(replacement);

assert.equals(replacement.parentNode, apple.el);
}

});
});
3 changes: 3 additions & 0 deletions test/tests/module.add.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
var assert = buster.assertions.assert;
var refute = buster.assertions.refute;

buster.testCase('View#add()', {
"setUp": function() {
this.view = new helpers.Views.List();
Expand Down
3 changes: 2 additions & 1 deletion test/tests/module.classes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var assert = buster.assertions.assert;

buster.testCase('View#classes()', {

Expand Down Expand Up @@ -32,4 +33,4 @@ buster.testCase('View#classes()', {
assert.isTrue(!!~apple.el.className.indexOf('foo'));
assert.isTrue(!!~apple.el.className.indexOf('bar'));
}
});
});
5 changes: 4 additions & 1 deletion test/tests/module.destroy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var assert = buster.assertions.assert;
var refute = buster.assertions.refute;

buster.testCase('View#destroy()', {
setUp: function() {
Expand All @@ -15,6 +17,7 @@ buster.testCase('View#destroy()', {

this.view.destroy();

assert.called(destroy);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This spy didn't appear to have any assertions on it.

assert.called(destroy2);
},

Expand Down Expand Up @@ -105,4 +108,4 @@ buster.testCase('View#destroy()', {
tearDown: function() {
helpers.destroyView.call(this);
}
});
});
4 changes: 3 additions & 1 deletion test/tests/module.empty.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var assert = buster.assertions.assert;
var refute = buster.assertions.refute;

buster.testCase('View#empty()', {

Expand Down Expand Up @@ -38,4 +40,4 @@ buster.testCase('View#empty()', {

refute(list.el.querySelector('apple'));
}
});
});
1 change: 1 addition & 0 deletions test/tests/module.extend.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var assert = buster.assertions.assert;

buster.testCase('Extend', {
"Defining reserved methods should rewrite keys with prefixed with '_'": function() {
Expand Down
16 changes: 9 additions & 7 deletions test/tests/module.fire.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var assert = buster.assertions.assert;
var refute = buster.assertions.refute;

buster.testCase('View#fire()', {
setUp: helpers.createView,
Expand All @@ -7,7 +9,7 @@ buster.testCase('View#fire()', {

this.view.on('testevent', spy);
this.view.fire('testevent');
assert.called(spy);
assert.called(spy);
},

"Events should bubble by default": function() {
Expand All @@ -17,7 +19,7 @@ buster.testCase('View#fire()', {
this.view.on('childtestevent', spy);
child.fire('childtestevent');

assert.called(spy);
assert.called(spy);
},

"Calling event.stopPropagation() should stop bubbling": function() {
Expand All @@ -30,7 +32,7 @@ buster.testCase('View#fire()', {
});

child.fire('childtestevent');
refute.called(spy);
refute.called(spy);
},

"Should pass arguments to the callback": function() {
Expand All @@ -42,9 +44,9 @@ buster.testCase('View#fire()', {
this.view.on('childtestevent', spy);
this.view.fire('childtestevent', arg1, arg2, arg3);

assert.equals(spy.args[0][0], arg1);
assert.equals(spy.args[0][1], arg2);
assert.equals(spy.args[0][2], arg3);
assert.equals(spy.args[0][0], arg1);
assert.equals(spy.args[0][1], arg2);
assert.equals(spy.args[0][2], arg3);
},

"Should allow multiple events to be in progress on the same view": function() {
Expand All @@ -71,4 +73,4 @@ buster.testCase('View#fire()', {
},

tearDown: helpers.destroyView
});
});
14 changes: 8 additions & 6 deletions test/tests/module.fireStatic.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var assert = buster.assertions.assert;
var refute = buster.assertions.refute;

buster.testCase('View#fireStatic()', {
setUp: helpers.createView,
Expand All @@ -7,7 +9,7 @@ buster.testCase('View#fireStatic()', {

this.view.on('testevent', spy);
this.view.fireStatic('testevent');
assert.called(spy);
assert.called(spy);
},

"Events should not bubble up to parent views": function() {
Expand All @@ -16,7 +18,7 @@ buster.testCase('View#fireStatic()', {

this.view.on('childtestevent', spy);
child.fireStatic('childtestevent');
refute.called(spy);
refute.called(spy);
},

"Should pass arguments to the callback": function() {
Expand All @@ -28,10 +30,10 @@ buster.testCase('View#fireStatic()', {
this.view.on('childtestevent', spy);
this.view.fireStatic('childtestevent', arg1, arg2, arg3);

assert.equals(spy.args[0][0], arg1);
assert.equals(spy.args[0][1], arg2);
assert.equals(spy.args[0][2], arg3);
assert.equals(spy.args[0][0], arg1);
assert.equals(spy.args[0][1], arg2);
assert.equals(spy.args[0][2], arg3);
},

tearDown: helpers.destroyView
});
});
4 changes: 3 additions & 1 deletion test/tests/module.id.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var assert = buster.assertions.assert;
var refute = buster.assertions.refute;

buster.testCase('View#id()', {
setUp: helpers.createView,
Expand Down Expand Up @@ -30,4 +32,4 @@ buster.testCase('View#id()', {
},

tearDown: helpers.tearDown
});
});
3 changes: 2 additions & 1 deletion test/tests/module.inject.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var assert = buster.assertions.assert;

buster.testCase('View#inject()', {
setUp: helpers.createView,
Expand All @@ -16,4 +17,4 @@ buster.testCase('View#inject()', {
helpers.emptySandbox();
helpers.destroyView.call(this);
}
});
});
5 changes: 3 additions & 2 deletions test/tests/module.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var assert = buster.assertions.assert;

buster.testCase('View', {
"Should add any children passed into the constructor": function() {
Expand Down Expand Up @@ -64,7 +65,7 @@ buster.testCase('View', {
}
});

assert.equals(layout.module('apple').slot, 2);
assert.equals(layout.module('apple').slot, '2');
},

"Should create a model": function() {
Expand Down Expand Up @@ -176,4 +177,4 @@ buster.testCase('View', {

assert.equals(['my class'], options.classes);
}
});
});
3 changes: 3 additions & 0 deletions test/tests/module.module.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
var assert = buster.assertions.assert;
var refute = buster.assertions.refute;

buster.testCase('View#module()', {
setUp: function() {
var layout = new Layout({});
Expand Down
2 changes: 2 additions & 0 deletions test/tests/module.on.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var assert = buster.assertions.assert;
var refute = buster.assertions.refute;

buster.testCase('View#on()', {
setUp: helpers.createView,
Expand Down
6 changes: 3 additions & 3 deletions test/tests/module.remove.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var assert = buster.assertions.assert;
var refute = buster.assertions.refute;

buster.testCase('View#remove()', {

Expand Down Expand Up @@ -37,7 +39,6 @@ buster.testCase('View#remove()', {
var list = new helpers.Views.Layout();
var Apple = helpers.Views.Apple;
var apple = new Apple({ slot: 1 });
var inDOM;

list
.add(apple)
Expand All @@ -57,7 +58,6 @@ buster.testCase('View#remove()', {
var list = new helpers.Views.Layout();
var Apple = helpers.Views.Apple;
var apple = new Apple();
var inDOM;

list
.add(apple, 1)
Expand Down Expand Up @@ -119,4 +119,4 @@ buster.testCase('View#remove()', {

assert(layout.module('apple'));
}
});
});
Loading