Skip to content

Commit

Permalink
* [jsfm] fix append tree
Browse files Browse the repository at this point in the history
  • Loading branch information
terrykingcha committed May 3, 2016
1 parent 0888e2c commit d3871b3
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/js-framework/lib/__test__/assets/append-root.output
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
style: {
flexDirection: 'column'
},
attr: {
append: "tree"
},
children: [{
type: 'container',
children: [{
Expand Down
3 changes: 3 additions & 0 deletions src/js-framework/lib/__test__/assets/append.output
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
children: [{
type: 'container',
event: ['click'],
attr: {
append: 'tree'
},
children: [{
type: 'container',
children: [{
Expand Down
10 changes: 8 additions & 2 deletions src/js-framework/lib/vm/__test__/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,14 @@ describe('generate workflow', () => {
function check() {
expect(vm._compile).callCount(3)
expect(vm._compile.args[0]).eql([target, dest])
expect(vm._compile.args[1]).eql([target.children[0], {type: 'a'}])
expect(vm._compile.args[2]).eql([target.children[1], {type: 'a'}])
expect(vm._compile.args[1]).eql([target.children[0], {
attr: {
append: 'tree'
}, type: 'a'}])
expect(vm._compile.args[2]).eql([target.children[1], {
attr: {
append: 'tree'
}, type: 'a'}])
expect(vm._createBlock).callCount(0)
expect(vm._mergeContext).callCount(0)
expect(vm.constructor).callCount(0)
Expand Down
4 changes: 3 additions & 1 deletion src/js-framework/lib/vm/__test__/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ describe('generate virtual dom for a single vm', () => {
expect(spy.firstCall.args[2]).to.deep.equal({
ref: '_root',
type: 'cell',
attr: {},
attr: {
append: 'tree'
},
style: {},
children: [{
ref: '3',
Expand Down
4 changes: 2 additions & 2 deletions src/js-framework/lib/vm/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ export function _compileNativeComponent(template, dest, type) {
}

if (template.append) { // give the append attribute for ios adaptation
template.attr = template.attr || {}
template.attr.append = template.append
element.attr = element.attr || {}
element.attr.append = template.append
}

const treeMode = template.append === 'tree'
Expand Down
2 changes: 1 addition & 1 deletion src/js-framework/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "weex-jsframework",
"version": "0.13.8",
"version": "0.13.9",
"description": "JS Framework for Weex solution which is a extendable cross-platform solution for dynamic programming and publishing projects",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit d3871b3

Please sign in to comment.