Skip to content

Commit

Permalink
#147, fixes cherry-pick, change api, updates test spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Kael committed Sep 23, 2015
1 parent 382a9b5 commit ca6ab2f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 53 deletions.
2 changes: 1 addition & 1 deletion dist/neuron-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'use strict';

var neuron = {
version: '7.1.2'
version: '8.0.0'
};

var NULL = null;
Expand Down
15 changes: 6 additions & 9 deletions dist/neuron.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'use strict';

var neuron = {
version: '7.1.2'
version: '8.0.0'
};

var NULL = null;
Expand Down Expand Up @@ -1377,16 +1377,13 @@ ENV.define = define;
// ### Usage
// ```
// // require biz modules with configs
// facade({
// entry: 'app-main-header-bar',
// data: {
// icon: 'http://kael.me/u/2012-03/icon.png'
// }
// facade('app-main-header-bar', {
// icon: 'http://kael.me/u/2012-03/icon.png'
// });
// ```
ENV.facade = function (item) {
use_module_by_id(item.entry, function(method) {
method.init && method.init(item.data);
ENV.facade = function (entry, data) {
use_module_by_id(entry, function(method) {
method.init && method.init(data);
});
};

Expand Down
13 changes: 5 additions & 8 deletions lib/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@ ENV.define = define;
// ### Usage
// ```
// // require biz modules with configs
// facade({
// entry: 'app-main-header-bar',
// data: {
// icon: 'http://kael.me/u/2012-03/icon.png'
// }
// facade('app-main-header-bar', {
// icon: 'http://kael.me/u/2012-03/icon.png'
// });
// ```
ENV.facade = function (item) {
use_module_by_id(item.entry, function(method) {
method.init && method.init(item.data);
ENV.facade = function (entry, data) {
use_module_by_id(entry, function(method) {
method.init && method.init(data);
});
};

Expand Down
51 changes: 16 additions & 35 deletions test/spec/facade.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ describe("facade", function() {
var POLL_INTERVAL = 10;

describe("facade(mod)", function() {
facade({
entry: 'require'
});
facade('require');

it("could load a neuron module", function(done) {
var timer = setInterval(function() {
Expand All @@ -38,9 +36,7 @@ describe("facade", function() {


describe("facade({mod}), to suppress interference, we use a new module", function() {
facade({
entry: 'require-2'
});
facade('require-2');

it("could load a neuron module", function(done) {
var timer = setInterval(function() {
Expand Down Expand Up @@ -69,11 +65,8 @@ describe("facade", function() {
it("could assign the value of the argument of `init` by `config`", function(done) {
var atom = {};

facade({
entry: 'require-3',
data: {
value: atom
}
facade('require-3', {
value: atom
});

var timer = setInterval(function() {
Expand All @@ -88,12 +81,9 @@ describe("facade", function() {

// test #72:
it("should apply ranges when facading a package", function(done) {
facade({
entry: 'range',
data: function(n) {
expect(n).to.equal(1);
done();
}
facade('range', function(n) {
expect(n).to.equal(1);
done();
});
});
});
Expand All @@ -109,12 +99,9 @@ describe("facade", function() {
});

it("load a package", function(done){
facade({
entry: 'facade',
data: function(n){
expect(n).to.equal(1);
done();
}
facade('facade', function(n){
expect(n).to.equal(1);
done();
});
});

Expand All @@ -136,12 +123,9 @@ describe("facade", function() {
});

it("load a script", function(done){
facade({
entry: 'facade2/a.js',
data: function(n){
expect(n).to.equal(1);
done();
}
facade('facade2/a.js', function(n){
expect(n).to.equal(1);
done();
});
});

Expand All @@ -164,12 +148,9 @@ describe("facade", function() {
});

it("load a script with version", function(done){
facade({
entry: 'facade3@1.1.0/a.js',
data: function(n){
expect(n).to.equal(1);
done();
}
facade('facade3@1.1.0/a.js', function(n){
expect(n).to.equal(1);
done();
});
});
});
Expand Down

0 comments on commit ca6ab2f

Please sign in to comment.