Skip to content

Commit

Permalink
Nested Creams support
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxenko committed Mar 28, 2017
1 parent 537eef1 commit 6b17165
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cakejs2",
"version": "0.0.19",
"version": "0.1.0",
"description": "Lightweight front-end framework with only best parts and features of most awesome frameworks.",
"main": "index.js",
"files": [
Expand All @@ -12,7 +12,7 @@
"LICENSE"
],
"dependencies": {
"basic-virtual-dom": "^0.2.6"
"basic-virtual-dom": "^0.3.0"
},
"devDependencies": {
"browserify": "^13.1.1",
Expand Down
17 changes: 17 additions & 0 deletions tests/cream.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var expect = require('chai').expect;
var Bakery = require('../');
var Cream = Bakery.Cream;
var h = require('../').h;

describe('Cream for the cake', function() {
afterEach(function() {
Expand Down Expand Up @@ -362,4 +363,20 @@ describe('Cream for the cake', function() {
expect(b.text).to.be.a('function');
expect(b.get('text')).to.be.equal('123');
});

it('should handle nested creams', function() {
var Nested = Cream.extend({
render: function() {
return h('div', null, this.props.name);
}
});

var Wrapper = Cream.extend({
render: function() {
return h(Nested, {name: 'prop-from-root'});
}
});

expect(Wrapper.render().children[0].children).to.be.equal('prop-from-root');
});
});

0 comments on commit 6b17165

Please sign in to comment.