You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ha...@apache.org on 2018/01/03 07:13:38 UTC
[07/22] incubator-weex git commit: * [jsfm] Adjust the file structure
of js framework
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/runtime/vdom/index.js
----------------------------------------------------------------------
diff --git a/runtime/vdom/index.js b/runtime/vdom/index.js
new file mode 100644
index 0000000..2947f5e
--- /dev/null
+++ b/runtime/vdom/index.js
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import Node from './Node'
+import Element from './Element'
+import Comment from './Comment'
+import Document from './Document'
+
+export {
+ registerElement,
+ unregisterElement,
+ isWeexElement,
+ clearWeexElements
+} from './WeexElement'
+
+export {
+ Document,
+ Node,
+ Element,
+ Comment
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/runtime/vdom/operation.js
----------------------------------------------------------------------
diff --git a/runtime/vdom/operation.js b/runtime/vdom/operation.js
new file mode 100644
index 0000000..69a64e1
--- /dev/null
+++ b/runtime/vdom/operation.js
@@ -0,0 +1,272 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const docMap = {}
+
+/**
+ * Add a document object into docMap.
+ * @param {string} id
+ * @param {object} document
+ */
+export function addDoc (id, doc) {
+ if (id) {
+ docMap[id] = doc
+ }
+}
+
+/**
+ * Get the document object by id.
+ * @param {string} id
+ */
+export function getDoc (id) {
+ return docMap[id]
+}
+
+/**
+ * Remove the document from docMap by id.
+ * @param {string} id
+ */
+export function removeDoc (id) {
+ delete docMap[id]
+}
+
+/**
+ * @deprecated
+ * Get listener by document id.
+ * @param {string} id
+ * @return {object} listener
+ */
+export function getListener (id) {
+ const doc = docMap[id]
+ if (doc && doc.listener) {
+ return doc.listener
+ }
+ return null
+}
+
+/**
+ * Get TaskCenter instance by id.
+ * @param {string} id
+ * @return {object} TaskCenter
+ */
+export function getTaskCenter (id) {
+ const doc = docMap[id]
+ if (doc && doc.taskCenter) {
+ return doc.taskCenter
+ }
+ return null
+}
+
+/**
+ * Append body node to documentElement.
+ * @param {object} document
+ * @param {object} node
+ * @param {object} before
+ */
+export function appendBody (doc, node, before) {
+ const { documentElement } = doc
+
+ if (documentElement.pureChildren.length > 0 || node.parentNode) {
+ return
+ }
+ const children = documentElement.children
+ const beforeIndex = children.indexOf(before)
+ if (beforeIndex < 0) {
+ children.push(node)
+ }
+ else {
+ children.splice(beforeIndex, 0, node)
+ }
+
+ if (node.nodeType === 1) {
+ if (node.role === 'body') {
+ node.docId = doc.id
+ node.ownerDocument = doc
+ node.parentNode = documentElement
+ linkParent(node, documentElement)
+ }
+ else {
+ node.children.forEach(child => {
+ child.parentNode = node
+ })
+ setBody(doc, node)
+ node.docId = doc.id
+ node.ownerDocument = doc
+ linkParent(node, documentElement)
+ delete doc.nodeMap[node.nodeId]
+ }
+ documentElement.pureChildren.push(node)
+ sendBody(doc, node)
+ }
+ else {
+ node.parentNode = documentElement
+ doc.nodeMap[node.ref] = node
+ }
+}
+
+function sendBody (doc, node) {
+ const body = node.toJSON()
+ if (doc && doc.taskCenter && typeof doc.taskCenter.send === 'function') {
+ doc.taskCenter.send('dom', { action: 'createBody' }, [body])
+ }
+}
+
+/**
+ * Set up body node.
+ * @param {object} document
+ * @param {object} element
+ */
+export function setBody (doc, el) {
+ el.role = 'body'
+ el.depth = 1
+ delete doc.nodeMap[el.nodeId]
+ el.ref = '_root'
+ doc.nodeMap._root = el
+ doc.body = el
+}
+
+/**
+ * Establish the connection between parent and child node.
+ * @param {object} child node
+ * @param {object} parent node
+ */
+export function linkParent (node, parent) {
+ node.parentNode = parent
+ if (parent.docId) {
+ node.docId = parent.docId
+ node.ownerDocument = parent.ownerDocument
+ node.ownerDocument.nodeMap[node.nodeId] = node
+ node.depth = parent.depth + 1
+ }
+ node.children.forEach(child => {
+ linkParent(child, node)
+ })
+}
+
+/**
+ * Get the next sibling element.
+ * @param {object} node
+ */
+export function nextElement (node) {
+ while (node) {
+ if (node.nodeType === 1) {
+ return node
+ }
+ node = node.nextSibling
+ }
+}
+
+/**
+ * Get the previous sibling element.
+ * @param {object} node
+ */
+export function previousElement (node) {
+ while (node) {
+ if (node.nodeType === 1) {
+ return node
+ }
+ node = node.previousSibling
+ }
+}
+
+/**
+ * Insert a node into list at the specified index.
+ * @param {object} target node
+ * @param {array} list
+ * @param {number} newIndex
+ * @param {boolean} changeSibling
+ * @return {number} newIndex
+ */
+export function insertIndex (target, list, newIndex, changeSibling) {
+ /* istanbul ignore next */
+ if (newIndex < 0) {
+ newIndex = 0
+ }
+ const before = list[newIndex - 1]
+ const after = list[newIndex]
+ list.splice(newIndex, 0, target)
+ if (changeSibling) {
+ before && (before.nextSibling = target)
+ target.previousSibling = before
+ target.nextSibling = after
+ after && (after.previousSibling = target)
+ }
+ return newIndex
+}
+
+/**
+ * Move the node to a new index in list.
+ * @param {object} target node
+ * @param {array} list
+ * @param {number} newIndex
+ * @param {boolean} changeSibling
+ * @return {number} newIndex
+ */
+export function moveIndex (target, list, newIndex, changeSibling) {
+ const index = list.indexOf(target)
+ /* istanbul ignore next */
+ if (index < 0) {
+ return -1
+ }
+ if (changeSibling) {
+ const before = list[index - 1]
+ const after = list[index + 1]
+ before && (before.nextSibling = after)
+ after && (after.previousSibling = before)
+ }
+ list.splice(index, 1)
+ let newIndexAfter = newIndex
+ if (index <= newIndex) {
+ newIndexAfter = newIndex - 1
+ }
+ const beforeNew = list[newIndexAfter - 1]
+ const afterNew = list[newIndexAfter]
+ list.splice(newIndexAfter, 0, target)
+ if (changeSibling) {
+ beforeNew && (beforeNew.nextSibling = target)
+ target.previousSibling = beforeNew
+ target.nextSibling = afterNew
+ afterNew && (afterNew.previousSibling = target)
+ }
+ if (index === newIndexAfter) {
+ return -1
+ }
+ return newIndex
+}
+
+/**
+ * Remove the node from list.
+ * @param {object} target node
+ * @param {array} list
+ * @param {boolean} changeSibling
+ */
+export function removeIndex (target, list, changeSibling) {
+ const index = list.indexOf(target)
+ /* istanbul ignore next */
+ if (index < 0) {
+ return
+ }
+ if (changeSibling) {
+ const before = list[index - 1]
+ const after = list[index + 1]
+ before && (before.nextSibling = after)
+ after && (after.previousSibling = before)
+ }
+ list.splice(index, 1)
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/.eslintrc
----------------------------------------------------------------------
diff --git a/test/js-framework/case/.eslintrc b/test/js-framework/case/.eslintrc
new file mode 100644
index 0000000..c892a87
--- /dev/null
+++ b/test/js-framework/case/.eslintrc
@@ -0,0 +1,9 @@
+{
+ "globals": {
+ "callNativeHandler": true,
+ },
+
+ "rules": {
+ "no-eval": "off"
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/append-root.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/append-root.output.js b/test/js-framework/case/basic/append-root.output.js
new file mode 100644
index 0000000..3c4a5a4
--- /dev/null
+++ b/test/js-framework/case/basic/append-root.output.js
@@ -0,0 +1,36 @@
+{
+ type: 'container',
+ style: {
+ flexDirection: 'column'
+ },
+ attr: {
+ append: "tree"
+ },
+ children: [{
+ type: 'container',
+ children: [{
+ type: 'image',
+ attr: {
+ src: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: 'title1'
+ }
+ }]
+ }, {
+ type: 'container',
+ children: [{
+ type: 'image',
+ attr: {
+ src: 'https://gd1.alicdn.com/bao/uploaded/i1/TB1PXJCJFXXXXciXFXXXXXXXXXX_!!0-item_pic.jpg'
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: 'title2'
+ }
+ }]
+ }]
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/append-root.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/append-root.source.js b/test/js-framework/case/basic/append-root.source.js
new file mode 100644
index 0000000..dfe60d7
--- /dev/null
+++ b/test/js-framework/case/basic/append-root.source.js
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/append', function(require, exports, module) {;
+ module.exports = {
+ data: function() {
+ return {
+ itemList: [{
+ itemId: '520421163634',
+ title: 'title1',
+ pictureUrl: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'
+ }, {
+ itemId: '522076777462',
+ title: 'title2',
+ pictureUrl: 'https://gd1.alicdn.com/bao/uploaded/i1/TB1PXJCJFXXXXciXFXXXXXXXXXX_!!0-item_pic.jpg'
+ }]
+ }
+ }
+ }
+
+
+ ;
+ module.exports.style = {}
+
+ ;
+ module.exports.template = {
+ "type": "container",
+ "style": {
+ "flexDirection": "column"
+ },
+ "append": "tree",
+ "children": [{
+ "type": "container",
+ "children": [{
+ "type": "image",
+ "attr": {
+ "src": function() {
+ return this.pictureUrl
+ }
+ }
+ }, {
+ "type": "text",
+ "attr": {
+ "value": function() {
+ return this.title
+ }
+ }
+ }],
+ "repeat": function() {
+ return this.itemList
+ }
+ }]
+ }
+
+ ;
+})
+
+// require module
+
+bootstrap('@weex-component/append')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/append.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/append.output.js b/test/js-framework/case/basic/append.output.js
new file mode 100644
index 0000000..5259fb6
--- /dev/null
+++ b/test/js-framework/case/basic/append.output.js
@@ -0,0 +1,79 @@
+{
+ type: 'container',
+ style: {
+ flexDirection: 'column'
+ },
+ children: [{
+ type: 'container',
+ event: ['click'],
+ attr: {
+ append: 'tree'
+ },
+ children: [{
+ type: 'container',
+ children: [{
+ type: 'text',
+ attr: {
+ value: 'any text'
+ }
+ }]
+ }, {
+ type: 'image',
+ attr: {
+ src: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'
+ },
+ style: {
+ width: 200,
+ height: 200
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: 'title1'
+ },
+ style: {
+ flex: 1,
+ color: '#ff0000',
+ fontSize: 48,
+ fontWeight: 'bold',
+ backgroundColor: '#eeeeee'
+ }
+ }]
+ }, {
+ type: 'container',
+ event: ['click'],
+ attr: {
+ append: 'tree'
+ },
+ children: [{
+ type: 'container',
+ children: [{
+ type: 'text',
+ attr: {
+ value: 'any text'
+ }
+ }]
+ }, {
+ type: 'image',
+ attr: {
+ src: 'https://gd1.alicdn.com/bao/uploaded/i1/TB1PXJCJFXXXXciXFXXXXXXXXXX_!!0-item_pic.jpg'
+ },
+ style: {
+ width: 200,
+ height: 200
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: 'title2'
+ },
+ style: {
+ flex: 1,
+ color: '#ff0000',
+ fontSize: 48,
+ fontWeight: 'bold',
+ backgroundColor: '#eeeeee'
+ }
+ }]
+ }]
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/append.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/append.source.js b/test/js-framework/case/basic/append.source.js
new file mode 100644
index 0000000..c216578
--- /dev/null
+++ b/test/js-framework/case/basic/append.source.js
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/taobao-item', function (require, exports, module) {
+
+;
+ module.exports = {
+ data: function () {return {
+ itemId: '',
+ title: '',
+ pictureUrl: ''
+ }},
+ methods: {
+ gotoDetail: function () {
+ this.$openURL('https://item.taobao.com/item.htm?id=' + this.itemId)
+ }
+ }
+ }
+
+
+;module.exports.style = {
+ "thumb": {
+ "width": 200,
+ "height": 200
+ },
+ "title": {
+ "flex": 1,
+ "color": "#ff0000",
+ "fontSize": 48,
+ "fontWeight": "bold",
+ "backgroundColor": "#eeeeee"
+ }
+}
+
+;module.exports.template = {
+ "type": "container",
+ "events": {
+ "click": "gotoDetail"
+ },
+ "append": "tree",
+ "children": [
+ {
+ "type": "container",
+ "children": [{
+ "type": "text",
+ "attr": {
+ "value": "any text"
+ }
+ }]
+ },
+ {
+ "type": "image",
+ "classList": [
+ "thumb"
+ ],
+ "attr": {
+ "src": function () {return this.pictureUrl}
+ }
+ },
+ {
+ "type": "text",
+ "classList": [
+ "title"
+ ],
+ "attr": {
+ "value": function () {return this.title}
+ }
+ }
+ ]
+}
+
+;})
+
+// module
+
+define('@weex-component/append', function (require, exports, module) {
+
+;
+ module.exports = {
+ data: function () {return {
+ itemList: [
+ {itemId: '520421163634', title: 'title1', pictureUrl: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'},
+ {itemId: '522076777462', title: 'title2', pictureUrl: 'https://gd1.alicdn.com/bao/uploaded/i1/TB1PXJCJFXXXXciXFXXXXXXXXXX_!!0-item_pic.jpg'}
+ ]
+ }}
+ }
+
+
+;module.exports.style = {}
+
+;module.exports.template = {
+ "type": "container",
+ "style": {
+ "flexDirection": "column"
+ },
+ "children": [
+ {
+ "type": "taobao-item",
+ "repeat": function () {return this.itemList}
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/append')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/backward1.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/backward1.output.js b/test/js-framework/case/basic/backward1.output.js
new file mode 100644
index 0000000..8f6d086
--- /dev/null
+++ b/test/js-framework/case/basic/backward1.output.js
@@ -0,0 +1,57 @@
+{
+ type: 'container',
+ style: {
+ flexDirection: 'column'
+ },
+ children: [{
+ type: 'container',
+ event: ['click'],
+ children: [{
+ type: 'image',
+ attr: {
+ src: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'
+ },
+ style: {
+ width: 200,
+ height: 200
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: 'title1'
+ },
+ style: {
+ flex: 1,
+ color: '#ff0000',
+ fontSize: 48,
+ fontWeight: 'bold',
+ backgroundColor: '#eeeeee'
+ }
+ }]
+ }, {
+ type: 'container',
+ event: ['click'],
+ children: [{
+ type: 'image',
+ attr: {
+ src: 'https://gd1.alicdn.com/bao/uploaded/i1/TB1PXJCJFXXXXciXFXXXXXXXXXX_!!0-item_pic.jpg'
+ },
+ style: {
+ width: 200,
+ height: 200
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: 'title2'
+ },
+ style: {
+ flex: 1,
+ color: '#ff0000',
+ fontSize: 48,
+ fontWeight: 'bold',
+ backgroundColor: '#eeeeee'
+ }
+ }]
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/backward1.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/backward1.source.js b/test/js-framework/case/basic/backward1.source.js
new file mode 100644
index 0000000..1bf6d74
--- /dev/null
+++ b/test/js-framework/case/basic/backward1.source.js
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+register('taobao-item', {
+
+ data: function() {
+ return {
+ itemId: '',
+ title: '',
+ pictureUrl: ''
+ };
+ },
+ methods: {
+ gotoDetail: function() {
+ this.$openURL('https://item.taobao.com/item.htm?id=' + this.itemId);
+ }
+ }
+
+ ,
+ style: {
+ "thumb": {
+ "width": 200,
+ "height": 200
+ },
+ "title": {
+ "flex": 1,
+ "color": "#ff0000",
+ "fontSize": 48,
+ "fontWeight": "bold",
+ "backgroundColor": "#eeeeee"
+ }
+ },
+ template: {
+ "type": "container",
+ "events": {
+ "click": "gotoDetail"
+ },
+ "children": [{
+ "type": "image",
+ "classList": [
+ "thumb"
+ ],
+ "attr": {
+ "src": function() {
+ return this.pictureUrl
+ }
+ }
+ }, {
+ "type": "text",
+ "classList": [
+ "title"
+ ],
+ "attr": {
+ "value": function() {
+ return this.title
+ }
+ }
+ }]
+ }
+})
+
+// module
+
+register('backward1', {
+
+ data: function() {
+ return {
+ itemList: [{
+ itemId: '520421163634',
+ title: 'title1',
+ pictureUrl: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'
+ }, {
+ itemId: '522076777462',
+ title: 'title2',
+ pictureUrl: 'https://gd1.alicdn.com/bao/uploaded/i1/TB1PXJCJFXXXXciXFXXXXXXXXXX_!!0-item_pic.jpg'
+ }]
+ };
+ }
+
+ ,
+ style: {},
+ template: {
+ "type": "container",
+ "style": {
+ "flexDirection": "column"
+ },
+ "children": [{
+ "type": "taobao-item",
+ "repeat": function() {
+ return this.itemList
+ }
+ }]
+ }
+})
+
+// require module
+
+render('backward1', {})
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/backward2.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/backward2.output.js b/test/js-framework/case/basic/backward2.output.js
new file mode 100644
index 0000000..8f6d086
--- /dev/null
+++ b/test/js-framework/case/basic/backward2.output.js
@@ -0,0 +1,57 @@
+{
+ type: 'container',
+ style: {
+ flexDirection: 'column'
+ },
+ children: [{
+ type: 'container',
+ event: ['click'],
+ children: [{
+ type: 'image',
+ attr: {
+ src: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'
+ },
+ style: {
+ width: 200,
+ height: 200
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: 'title1'
+ },
+ style: {
+ flex: 1,
+ color: '#ff0000',
+ fontSize: 48,
+ fontWeight: 'bold',
+ backgroundColor: '#eeeeee'
+ }
+ }]
+ }, {
+ type: 'container',
+ event: ['click'],
+ children: [{
+ type: 'image',
+ attr: {
+ src: 'https://gd1.alicdn.com/bao/uploaded/i1/TB1PXJCJFXXXXciXFXXXXXXXXXX_!!0-item_pic.jpg'
+ },
+ style: {
+ width: 200,
+ height: 200
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: 'title2'
+ },
+ style: {
+ flex: 1,
+ color: '#ff0000',
+ fontSize: 48,
+ fontWeight: 'bold',
+ backgroundColor: '#eeeeee'
+ }
+ }]
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/backward2.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/backward2.source.js b/test/js-framework/case/basic/backward2.source.js
new file mode 100644
index 0000000..cf4885a
--- /dev/null
+++ b/test/js-framework/case/basic/backward2.source.js
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('taobao-item', function (require, exports, module) {
+
+;
+ module.exports = {
+ data: function () {return {
+ itemId: '',
+ title: '',
+ pictureUrl: ''
+ }},
+ methods: {
+ gotoDetail: function () {
+ this.$openURL('https://item.taobao.com/item.htm?id=' + this.itemId)
+ }
+ }
+ }
+
+
+;module.exports.style = {
+ "thumb": {
+ "width": 200,
+ "height": 200
+ },
+ "title": {
+ "flex": 1,
+ "color": "#ff0000",
+ "fontSize": 48,
+ "fontWeight": "bold",
+ "backgroundColor": "#eeeeee"
+ }
+}
+
+;module.exports.template = {
+ "type": "container",
+ "events": {
+ "click": "gotoDetail"
+ },
+ "children": [
+ {
+ "type": "image",
+ "classList": [
+ "thumb"
+ ],
+ "attr": {
+ "src": function () {return this.pictureUrl}
+ }
+ },
+ {
+ "type": "text",
+ "classList": [
+ "title"
+ ],
+ "attr": {
+ "value": function () {return this.title}
+ }
+ }
+ ]
+}
+
+;})
+
+// module
+
+define('backward2', function (require, exports, module) {
+
+;
+ module.exports = {
+ data: function () {return {
+ itemList: [
+ {itemId: '520421163634', title: 'title1', pictureUrl: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'},
+ {itemId: '522076777462', title: 'title2', pictureUrl: 'https://gd1.alicdn.com/bao/uploaded/i1/TB1PXJCJFXXXXciXFXXXXXXXXXX_!!0-item_pic.jpg'}
+ ]
+ }}
+ }
+
+
+;module.exports.style = {}
+
+;module.exports.template = {
+ "type": "container",
+ "style": {
+ "flexDirection": "column"
+ },
+ "children": [
+ {
+ "type": "taobao-item",
+ "repeat": function () {return this.itemList}
+ }
+ ]
+}
+
+;})
+
+// require module
+
+require('backward2')()
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/components.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/components.output.js b/test/js-framework/case/basic/components.output.js
new file mode 100644
index 0000000..b7acaa4
--- /dev/null
+++ b/test/js-framework/case/basic/components.output.js
@@ -0,0 +1,20 @@
+{
+ "type": "container",
+ "children": [{
+ "type": "container",
+ "style": {
+ "marginTop": 10
+ },
+ "children": [{
+ "type": "text",
+ "attr": {
+ "value": "aa"
+ }
+ },{
+ "type": "text",
+ "attr": {
+ "value": "bb"
+ }
+ }]
+ }]
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/components.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/components.source.js b/test/js-framework/case/basic/components.source.js
new file mode 100644
index 0000000..f095486
--- /dev/null
+++ b/test/js-framework/case/basic/components.source.js
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+function otherNameFunction () {
+ var module = {}
+ var exports = {}
+ module.exports = exports
+
+ ;module.exports.style = {}
+
+ ;module.exports.template = {
+ "type": "container",
+ "children": [
+ {
+ "type": "text",
+ "attr": {
+ "value": function () {return this.outerData.a}
+ }
+ },
+ {
+ "type": "text",
+ "attr": {
+ "value": function () {return this.outerData.b}
+ }
+ }
+ ]
+ }
+
+ ;module.exports.created = function() {
+ this.outerData.a = 'aa'
+ }
+
+ ;module.exports.ready = function() {
+ this.outerData.b = 'bb'
+ }
+
+ return module.exports
+}
+
+// module
+
+define('@weex-component/subvm', function (require, exports, module) {
+
+;
+ module.exports = {
+ "components": {
+ innertpl: otherNameFunction()
+ },
+ data: function () {return {
+ item: {a: 'a', b: 'b'},
+ className: 'fromOuter',
+ marginTop: 10
+ }}
+ }
+
+
+;module.exports.style = {}
+
+;module.exports.template = {
+ "type": "container",
+ "children": [
+ {
+ "type": "innertpl",
+ "classList": function() {
+ return this.className
+ },
+ "style": {
+ marginTop: function() {
+ return this.marginTop
+ }
+ },
+ "events": {
+ "click": "clicked"
+ },
+ "attr": {
+ "outerData": function () {return this.item}
+ }
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/subvm')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/computed-in-repeat.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/computed-in-repeat.output.js b/test/js-framework/case/basic/computed-in-repeat.output.js
new file mode 100644
index 0000000..14a8d23
--- /dev/null
+++ b/test/js-framework/case/basic/computed-in-repeat.output.js
@@ -0,0 +1,19 @@
+{
+ "type": "div",
+ "children": [{
+ "type": "text",
+ "attr": {
+ "value": "Hello Evan You"
+ }
+ }, {
+ "type": "text",
+ "attr": {
+ "value": "Hello Terry King"
+ }
+ }, {
+ "type": "text",
+ "attr": {
+ "value": "Jack Ma"
+ }
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/computed-in-repeat.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/computed-in-repeat.source.js b/test/js-framework/case/basic/computed-in-repeat.source.js
new file mode 100644
index 0000000..fc203a9
--- /dev/null
+++ b/test/js-framework/case/basic/computed-in-repeat.source.js
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/e9b6b411765a9cc9e9d1a0469ae0a84c', function(require, exports, module) {
+
+ ;
+ module.exports = {
+ data: function() {
+ return {
+ firstName: 'Jack',
+ lastName: 'Ma',
+ peoples: [{
+ firstName: 'Evan',
+ lastName: 'You'
+ }, {
+ firstName: 'Terry',
+ lastName: 'King'
+ }]
+ }
+ },
+ computed: {
+ fullName: function() {
+ return this.firstName + ' ' + this.lastName
+ }
+ }
+ }
+
+
+ ;
+ module.exports.style = {}
+
+ ;
+ module.exports.template = {
+ "type": "div",
+ "classList": [
+ "bg"
+ ],
+ "children": [{
+ "type": "text",
+ "repeat": function() {
+ return this.peoples
+ },
+ "classList": [
+ "text"
+ ],
+ "attr": {
+ "value": function() {
+ return 'Hello ' + (this.fullName)
+ }
+ }
+ }, {
+ "type": "text",
+ "attr": {
+ "value": function() {
+ return this.fullName
+ }
+ }
+ }]
+ }
+
+ ;
+})
+
+// require module
+bootstrap('@weex-component/e9b6b411765a9cc9e9d1a0469ae0a84c', {
+ "transformerVersion": "0.3.1"
+})
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/created.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/created.output.js b/test/js-framework/case/basic/created.output.js
new file mode 100644
index 0000000..39c15f3
--- /dev/null
+++ b/test/js-framework/case/basic/created.output.js
@@ -0,0 +1,11 @@
+{
+ "children": [
+ {
+ "attr": {
+ "value": "1"
+ },
+ "type": "text"
+ }
+ ],
+ "type": "container"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/created.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/created.source.js b/test/js-framework/case/basic/created.source.js
new file mode 100644
index 0000000..dd2ee5b
--- /dev/null
+++ b/test/js-framework/case/basic/created.source.js
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/created', function(require, exports, module) {
+
+ ;
+ module.exports = {
+ data: function() {
+ return {
+ text: '',
+ }
+ },
+ created: function() {
+ this.text = '1'
+ }
+ }
+
+
+ ;
+ module.exports.style = {}
+
+ ;
+ module.exports.template = {
+ "type": "container",
+ "children": [{
+ "type": "text",
+ "attr": {
+ "value": function() {
+ return this.text
+ }
+ }
+ }]
+ }
+
+ ;
+})
+
+// require module
+bootstrap('@weex-component/created', {
+ "transformerVersion": "0.3.1"
+})
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/dynamic-id.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/dynamic-id.output.js b/test/js-framework/case/basic/dynamic-id.output.js
new file mode 100644
index 0000000..5029a30
--- /dev/null
+++ b/test/js-framework/case/basic/dynamic-id.output.js
@@ -0,0 +1,44 @@
+{
+ type: 'div',
+ children: [
+ {
+ type: 'text',
+ attr: {
+ value: 'Hello',
+ a: 1
+ }
+ },
+ {
+ type: 'text',
+ attr: {
+ value: 'Hello',
+ a: 1,
+ b: 1
+ }
+ },
+ {
+ type: 'text',
+ attr: {
+ value: 'Hello'
+ }
+ },
+ {
+ type: 'text',
+ attr: {
+ value: 'Hello'
+ }
+ },
+ {
+ type: 'text',
+ attr: {
+ value: 'Hello'
+ }
+ },
+ {
+ type: 'text',
+ attr: {
+ value: 'Hello'
+ }
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/dynamic-id.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/dynamic-id.source.js b/test/js-framework/case/basic/dynamic-id.source.js
new file mode 100644
index 0000000..6616cec
--- /dev/null
+++ b/test/js-framework/case/basic/dynamic-id.source.js
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/id', function (require, exports, module) {
+
+;
+ module.exports = {
+ ready: function () {
+ if (this.$el('x')) {
+ this.$el('x').setAttr('a', 1)
+ }
+ if (this.$el('y')) {
+ this.$el('y').setAttr('a', 1)
+ }
+ if (this.$el('')) {
+ this.$el('').setAttr('a', 1)
+ }
+ if (this.$el('0')) {
+ this.$el('0').setAttr('a', 1)
+ }
+ if (this.$el(0)) {
+ this.$el(0).setAttr('b', 1)
+ }
+ }
+ }
+
+;module.exports.template = {
+ "type": "div",
+ "children": [
+ {
+ "type": "text",
+ "id": function () { return "x" },
+ "attr": {
+ "value": "Hello"
+ }
+ },
+ {
+ "type": "text",
+ "id": function () { return 0 },
+ "attr": {
+ "value": "Hello"
+ }
+ },
+ {
+ "type": "text",
+ "id": function () { return '' },
+ "attr": {
+ "value": "Hello"
+ }
+ },
+ {
+ "type": "text",
+ "id": function () { return null },
+ "attr": {
+ "value": "Hello"
+ }
+ },
+ {
+ "type": "text",
+ "id": function () { return NaN },
+ "attr": {
+ "value": "Hello"
+ }
+ },
+ {
+ "type": "text",
+ "id": function () { return },
+ "attr": {
+ "value": "Hello"
+ }
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/id')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/dynamic-property.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/dynamic-property.output.js b/test/js-framework/case/basic/dynamic-property.output.js
new file mode 100644
index 0000000..8ccc9d5
--- /dev/null
+++ b/test/js-framework/case/basic/dynamic-property.output.js
@@ -0,0 +1,24 @@
+{
+ "type": "div",
+ "children": [{
+ "type": "text",
+ "attr": {
+ "value": "A: undefined"
+ }
+ }, {
+ "type": "text",
+ "attr": {
+ "value": "B: created"
+ }
+ }, {
+ "type": "text",
+ "attr": {
+ "value": "C: ready"
+ }
+ }, {
+ "type": "text",
+ "attr": {
+ "value": "D: initial"
+ }
+ }]
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/dynamic-property.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/dynamic-property.source.js b/test/js-framework/case/basic/dynamic-property.source.js
new file mode 100644
index 0000000..880d468
--- /dev/null
+++ b/test/js-framework/case/basic/dynamic-property.source.js
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/dynamic-property', function (require, exports, module) {
+
+ ;module.exports.style = {}
+
+ ;module.exports = {
+ data: function () {return {
+ A: {},
+ B: {},
+ C: {
+ message: 'initial'
+ },
+ D: {
+ message: 'initial'
+ }
+ }},
+
+ created: function() {
+ this.B.message = 'created'
+ this.C.message = 'created'
+ },
+
+ ready: function() {
+ this.A.message = 'ready'
+ this.B.message = 'ready'
+ this.C.message = 'ready'
+ }
+ }
+
+ ;module.exports.template = {
+ "type": "div",
+ "children": [
+ {
+ "type": "text",
+ "attr": {
+ "value": function () {return 'A: ' + (this.A.message)}
+ }
+ },
+ {
+ "type": "text",
+ "attr": {
+ "value": function () {return 'B: ' + (this.B.message)}
+ }
+ },
+ {
+ "type": "text",
+ "attr": {
+ "value": function () {return 'C: ' + (this.C.message)}
+ }
+ },
+ {
+ "type": "text",
+ "attr": {
+ "value": function () {return 'D: ' + (this.D.message)}
+ }
+ }
+ ]
+ }
+
+;})
+
+bootstrap('@weex-component/dynamic-property')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/dynamic-type.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/dynamic-type.output.js b/test/js-framework/case/basic/dynamic-type.output.js
new file mode 100644
index 0000000..d6881a4
--- /dev/null
+++ b/test/js-framework/case/basic/dynamic-type.output.js
@@ -0,0 +1,10 @@
+{
+ type: 'container',
+ children: [{
+ type: 'text',
+ style: {
+ width: 200,
+ height: 200
+ }
+ }]
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/dynamic-type.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/dynamic-type.source.js b/test/js-framework/case/basic/dynamic-type.source.js
new file mode 100644
index 0000000..62b8f72
--- /dev/null
+++ b/test/js-framework/case/basic/dynamic-type.source.js
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/dynamic-type', function (require, exports, module) {
+
+;
+ module.exports = {
+ data: function () {return {
+ type: 'text'
+ }}
+ }
+
+;module.exports.template = {
+ "type": "container",
+ "children": [
+ {
+ "type": function () {return this.type},
+ "style": {
+ "width": 200,
+ "height": 200
+ }
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/dynamic-type')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo.output.js b/test/js-framework/case/basic/foo.output.js
new file mode 100644
index 0000000..1372f91
--- /dev/null
+++ b/test/js-framework/case/basic/foo.output.js
@@ -0,0 +1,3 @@
+{
+ type: 'container'
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo.source.js b/test/js-framework/case/basic/foo.source.js
new file mode 100644
index 0000000..027eee1
--- /dev/null
+++ b/test/js-framework/case/basic/foo.source.js
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/foo', function (require, exports, module) {
+
+;
+ module.exports = {
+ data: function () {
+ return {
+ x: 1
+ }
+ }
+ }
+
+
+;module.exports.style = {
+ "a": {
+ "fontSize": 12
+ }
+}
+
+;module.exports.template = {
+ "type": "container"
+}
+
+;})
+
+
+bootstrap('@weex-component/foo')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo2.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo2.output.js b/test/js-framework/case/basic/foo2.output.js
new file mode 100644
index 0000000..d7cc321
--- /dev/null
+++ b/test/js-framework/case/basic/foo2.output.js
@@ -0,0 +1,10 @@
+{
+ type: 'container',
+ attr: {
+ a: '1',
+ b: 1
+ },
+ style: {
+ fontSize: 12
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo2.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo2.source.js b/test/js-framework/case/basic/foo2.source.js
new file mode 100644
index 0000000..cabf559
--- /dev/null
+++ b/test/js-framework/case/basic/foo2.source.js
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/foo2', function (require, exports, module) {
+
+;
+ module.exports = {
+ data: function () {
+ return {
+ x: 1
+ }
+ }
+ }
+
+
+;module.exports.style = {
+ "a": {
+ "fontSize": 12
+ }
+}
+
+;module.exports.template = {
+ "type": "container",
+ "attr": {
+ "a": "1",
+ "b": function () {return this.x}
+ },
+ "classList": [
+ "a"
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/foo2')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo3.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo3.output.js b/test/js-framework/case/basic/foo3.output.js
new file mode 100644
index 0000000..51c886e
--- /dev/null
+++ b/test/js-framework/case/basic/foo3.output.js
@@ -0,0 +1,9 @@
+{
+ type: 'container',
+ children: [{
+ type: 'text',
+ attr: {
+ value: 'Hello World'
+ }
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo3.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo3.source.js b/test/js-framework/case/basic/foo3.source.js
new file mode 100644
index 0000000..7fda995
--- /dev/null
+++ b/test/js-framework/case/basic/foo3.source.js
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/foo3', function (require, exports, module) {
+
+;
+
+;module.exports.style = {}
+
+;module.exports.template = {
+ "type": "container",
+ "children": [
+ {
+ "type": "text",
+ "attr": {
+ "value": "Hello World"
+ }
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/foo3')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo4.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo4.output.js b/test/js-framework/case/basic/foo4.output.js
new file mode 100644
index 0000000..bef3668
--- /dev/null
+++ b/test/js-framework/case/basic/foo4.output.js
@@ -0,0 +1,12 @@
+{
+ type: 'container',
+ children: [{
+ type: 'text',
+ attr: {
+ value: 'Hello World'
+ },
+ style: {
+ color: '#ff0000'
+ }
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo4.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo4.source.js b/test/js-framework/case/basic/foo4.source.js
new file mode 100644
index 0000000..f842abf
--- /dev/null
+++ b/test/js-framework/case/basic/foo4.source.js
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/foo4', function (require, exports, module) {
+
+;
+
+;module.exports.style = {}
+
+;module.exports.template = {
+ "type": "container",
+ "children": [
+ {
+ "type": "text",
+ "style": {
+ "color": "#ff0000"
+ },
+ "attr": {
+ "value": "Hello World"
+ }
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/foo4')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo5.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo5.output.js b/test/js-framework/case/basic/foo5.output.js
new file mode 100644
index 0000000..840cefb
--- /dev/null
+++ b/test/js-framework/case/basic/foo5.output.js
@@ -0,0 +1,14 @@
+{
+ type: 'container',
+ children: [{
+ type: 'text',
+ attr: {
+ value: 'Hello World'
+ },
+ style: {
+ color: '#ff0000',
+ fontSize: 48,
+ fontWeight: 'bold'
+ }
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo5.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo5.source.js b/test/js-framework/case/basic/foo5.source.js
new file mode 100644
index 0000000..b09fc03
--- /dev/null
+++ b/test/js-framework/case/basic/foo5.source.js
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/foo5', function (require, exports, module) {
+
+;
+
+;module.exports.style = {
+ "title": {
+ "color": "#ff0000",
+ "fontSize": 48,
+ "fontWeight": "bold"
+ }
+}
+
+;module.exports.template = {
+ "type": "container",
+ "children": [
+ {
+ "type": "text",
+ "classList": [
+ "title"
+ ],
+ "attr": {
+ "value": "Hello World"
+ }
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/foo5')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo6.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo6.output.js b/test/js-framework/case/basic/foo6.output.js
new file mode 100644
index 0000000..1a8fd90
--- /dev/null
+++ b/test/js-framework/case/basic/foo6.output.js
@@ -0,0 +1,28 @@
+{
+ type: 'container',
+ style: {
+ flexDirection: 'row'
+ },
+ children: [{
+ type: 'image',
+ attr: {
+ src: 'http://gw.alicdn.com/tfscom/TB1OMfAJFXXXXbfXXXXqVMCNVXX-400-400.jpg'
+ },
+ style: {
+ width: 200,
+ height: 200
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: '一个超赞的宝贝标题'
+ },
+ style: {
+ flex: 1,
+ color: '#ff0000',
+ fontSize: 48,
+ fontWeight: 'bold',
+ backgroundColor: '#eeeeee'
+ }
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo6.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo6.source.js b/test/js-framework/case/basic/foo6.source.js
new file mode 100644
index 0000000..4301a50
--- /dev/null
+++ b/test/js-framework/case/basic/foo6.source.js
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/foo6', function (require, exports, module) {
+
+;
+
+;module.exports.style = {
+ "container": {
+ "flexDirection": "row"
+ },
+ "thumb": {
+ "width": 200,
+ "height": 200
+ },
+ "title": {
+ "flex": 1,
+ "color": "#ff0000",
+ "fontSize": 48,
+ "fontWeight": "bold",
+ "backgroundColor": "#eeeeee"
+ }
+}
+
+;module.exports.template = {
+ "type": "container",
+ "classList": [
+ "container"
+ ],
+ "children": [
+ {
+ "type": "image",
+ "classList": [
+ "thumb"
+ ],
+ "attr": {
+ "src": "http://gw.alicdn.com/tfscom/TB1OMfAJFXXXXbfXXXXqVMCNVXX-400-400.jpg"
+ }
+ },
+ {
+ "type": "text",
+ "classList": [
+ "title"
+ ],
+ "attr": {
+ "value": "一个超赞的宝贝标题"
+ }
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/foo6')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo7.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo7.output.js b/test/js-framework/case/basic/foo7.output.js
new file mode 100644
index 0000000..d19c92f
--- /dev/null
+++ b/test/js-framework/case/basic/foo7.output.js
@@ -0,0 +1,26 @@
+{
+ type: 'container',
+ event: ['click'],
+ children: [{
+ type: 'image',
+ attr: {
+ src: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'
+ },
+ style: {
+ width: 200,
+ height: 200
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: '一个超赞的宝贝标题'
+ },
+ style: {
+ flex: 1,
+ color: '#ff0000',
+ fontSize: 48,
+ fontWeight: 'bold',
+ backgroundColor: '#eeeeee'
+ }
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo7.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo7.source.js b/test/js-framework/case/basic/foo7.source.js
new file mode 100644
index 0000000..2d9b43f
--- /dev/null
+++ b/test/js-framework/case/basic/foo7.source.js
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/foo7', function (require, exports, module) {
+
+;
+ module.exports = {
+ methods: {
+ gotoDetail: function () {
+ this.$openURL('https://item.taobao.com/item.htm?id=520421163634')
+ }
+ }
+ }
+
+
+;module.exports.style = {
+ "thumb": {
+ "width": 200,
+ "height": 200
+ },
+ "title": {
+ "flex": 1,
+ "color": "#ff0000",
+ "fontSize": 48,
+ "fontWeight": "bold",
+ "backgroundColor": "#eeeeee"
+ }
+}
+
+;module.exports.template = {
+ "type": "container",
+ "events": {
+ "click": "gotoDetail"
+ },
+ "children": [
+ {
+ "type": "image",
+ "classList": [
+ "thumb"
+ ],
+ "attr": {
+ "src": "https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg"
+ }
+ },
+ {
+ "type": "text",
+ "classList": [
+ "title"
+ ],
+ "attr": {
+ "value": "一个超赞的宝贝标题"
+ }
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/foo7')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo8.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo8.output.js b/test/js-framework/case/basic/foo8.output.js
new file mode 100644
index 0000000..8ed4bb1
--- /dev/null
+++ b/test/js-framework/case/basic/foo8.output.js
@@ -0,0 +1,60 @@
+{
+ type: 'container',
+ children: [{
+ type: 'container',
+ style: {
+ flexDirection: 'row'
+ },
+ event: ['click'],
+ children: [{
+ type: 'image',
+ attr: {
+ src: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'
+ },
+ style: {
+ width: 200,
+ height: 200
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: 'title1'
+ },
+ style: {
+ flex: 1,
+ color: '#ff0000',
+ fontSize: 48,
+ fontWeight: 'bold',
+ backgroundColor: '#eeeeee'
+ }
+ }]
+ }, {
+ type: 'container',
+ style: {
+ flexDirection: 'row'
+ },
+ event: ['click'],
+ children: [{
+ type: 'image',
+ attr: {
+ src: 'https://gd1.alicdn.com/bao/uploaded/i1/TB1PXJCJFXXXXciXFXXXXXXXXXX_!!0-item_pic.jpg'
+ },
+ style: {
+ width: 200,
+ height: 200
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: 'title2'
+ },
+ style: {
+ flex: 1,
+ color: '#ff0000',
+ fontSize: 48,
+ fontWeight: 'bold',
+ backgroundColor: '#eeeeee'
+ }
+ }]
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo8.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo8.source.js b/test/js-framework/case/basic/foo8.source.js
new file mode 100644
index 0000000..d2512f2
--- /dev/null
+++ b/test/js-framework/case/basic/foo8.source.js
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/foo8', function (require, exports, module) {
+
+;
+ module.exports = {
+ data: function () {return {
+ itemList: [
+ {itemId: '520421163634', title: 'title1', pictureUrl: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'},
+ {itemId: '522076777462', title: 'title2', pictureUrl: 'https://gd1.alicdn.com/bao/uploaded/i1/TB1PXJCJFXXXXciXFXXXXXXXXXX_!!0-item_pic.jpg'}
+ ]
+ }},
+ methods: {
+ gotoDetail: function () {
+ this.$openURL('https://item.taobao.com/item.htm?id=' + this.itemId)
+ }
+ }
+ }
+
+
+;module.exports.style = {
+ "thumb": {
+ "width": 200,
+ "height": 200
+ },
+ "title": {
+ "flex": 1,
+ "color": "#ff0000",
+ "fontSize": 48,
+ "fontWeight": "bold",
+ "backgroundColor": "#eeeeee"
+ }
+}
+
+;module.exports.template = {
+ "type": "container",
+ "children": [
+ {
+ "type": "container",
+ "repeat": function () {return this.itemList},
+ "events": {
+ "click": "gotoDetail"
+ },
+ "style": {
+ "flexDirection": "row"
+ },
+ "children": [
+ {
+ "type": "image",
+ "classList": [
+ "thumb"
+ ],
+ "attr": {
+ "src": function () {return this.pictureUrl}
+ }
+ },
+ {
+ "type": "text",
+ "classList": [
+ "title"
+ ],
+ "attr": {
+ "value": function () {return this.title}
+ }
+ }
+ ]
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/foo8')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo9.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo9.output.js b/test/js-framework/case/basic/foo9.output.js
new file mode 100644
index 0000000..8f6d086
--- /dev/null
+++ b/test/js-framework/case/basic/foo9.output.js
@@ -0,0 +1,57 @@
+{
+ type: 'container',
+ style: {
+ flexDirection: 'column'
+ },
+ children: [{
+ type: 'container',
+ event: ['click'],
+ children: [{
+ type: 'image',
+ attr: {
+ src: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'
+ },
+ style: {
+ width: 200,
+ height: 200
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: 'title1'
+ },
+ style: {
+ flex: 1,
+ color: '#ff0000',
+ fontSize: 48,
+ fontWeight: 'bold',
+ backgroundColor: '#eeeeee'
+ }
+ }]
+ }, {
+ type: 'container',
+ event: ['click'],
+ children: [{
+ type: 'image',
+ attr: {
+ src: 'https://gd1.alicdn.com/bao/uploaded/i1/TB1PXJCJFXXXXciXFXXXXXXXXXX_!!0-item_pic.jpg'
+ },
+ style: {
+ width: 200,
+ height: 200
+ }
+ }, {
+ type: 'text',
+ attr: {
+ value: 'title2'
+ },
+ style: {
+ flex: 1,
+ color: '#ff0000',
+ fontSize: 48,
+ fontWeight: 'bold',
+ backgroundColor: '#eeeeee'
+ }
+ }]
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/foo9.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/foo9.source.js b/test/js-framework/case/basic/foo9.source.js
new file mode 100644
index 0000000..da534e9
--- /dev/null
+++ b/test/js-framework/case/basic/foo9.source.js
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/taobao-item', function (require, exports, module) {
+
+;
+ module.exports = {
+ data: function () {return {
+ itemId: '',
+ title: '',
+ pictureUrl: ''
+ }},
+ methods: {
+ gotoDetail: function () {
+ this.$openURL('https://item.taobao.com/item.htm?id=' + this.itemId)
+ }
+ }
+ }
+
+
+;module.exports.style = {
+ "thumb": {
+ "width": 200,
+ "height": 200
+ },
+ "title": {
+ "flex": 1,
+ "color": "#ff0000",
+ "fontSize": 48,
+ "fontWeight": "bold",
+ "backgroundColor": "#eeeeee"
+ }
+}
+
+;module.exports.template = {
+ "type": "container",
+ "events": {
+ "click": "gotoDetail"
+ },
+ "children": [
+ {
+ "type": "image",
+ "classList": [
+ "thumb"
+ ],
+ "attr": {
+ "src": function () {return this.pictureUrl}
+ }
+ },
+ {
+ "type": "text",
+ "classList": [
+ "title"
+ ],
+ "attr": {
+ "value": function () {return this.title}
+ }
+ }
+ ]
+}
+
+;})
+
+// module
+
+define('@weex-component/foo9', function (require, exports, module) {
+
+;
+ module.exports = {
+ data: function () {return {
+ itemList: [
+ {itemId: '520421163634', title: 'title1', pictureUrl: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'},
+ {itemId: '522076777462', title: 'title2', pictureUrl: 'https://gd1.alicdn.com/bao/uploaded/i1/TB1PXJCJFXXXXciXFXXXXXXXXXX_!!0-item_pic.jpg'}
+ ]
+ }}
+ }
+
+
+;module.exports.style = {}
+
+;module.exports.template = {
+ "type": "container",
+ "style": {
+ "flexDirection": "column"
+ },
+ "children": [
+ {
+ "type": "taobao-item",
+ "repeat": function () {return this.itemList}
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/foo9')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/global-weex-object.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/global-weex-object.output.js b/test/js-framework/case/basic/global-weex-object.output.js
new file mode 100644
index 0000000..3e1fa19
--- /dev/null
+++ b/test/js-framework/case/basic/global-weex-object.output.js
@@ -0,0 +1,6 @@
+{
+ type: 'div',
+ attr: {
+ a: 'WeexDemo'
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/global-weex-object.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/global-weex-object.source.js b/test/js-framework/case/basic/global-weex-object.source.js
new file mode 100644
index 0000000..252af7e
--- /dev/null
+++ b/test/js-framework/case/basic/global-weex-object.source.js
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+weex.define('@weex-component/foo', function (require, exports, module) {
+ module.exports = {
+ data: function () {
+ return {
+ x: weex.config.env.appName
+ }
+ },
+ template: {
+ "type": "div",
+ "attr": {
+ "a": function () {
+ return this.x
+ }
+ }
+ }
+ }
+})
+
+weex.bootstrap('@weex-component/foo')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/id.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/id.output.js b/test/js-framework/case/basic/id.output.js
new file mode 100644
index 0000000..7ce073c
--- /dev/null
+++ b/test/js-framework/case/basic/id.output.js
@@ -0,0 +1,32 @@
+{
+ type: 'div',
+ children: [
+ {
+ type: 'text',
+ attr: {
+ value: 'Hello',
+ a: 1
+ }
+ },
+ {
+ type: 'text',
+ attr: {
+ value: 'Hello',
+ a: 1,
+ b: 1
+ }
+ },
+ {
+ type: 'text',
+ attr: {
+ value: 'Hello'
+ }
+ },
+ {
+ type: 'text',
+ attr: {
+ value: 'Hello'
+ }
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/id.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/id.source.js b/test/js-framework/case/basic/id.source.js
new file mode 100644
index 0000000..3c85886
--- /dev/null
+++ b/test/js-framework/case/basic/id.source.js
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/id', function (require, exports, module) {
+
+;
+ module.exports = {
+ ready: function () {
+ if (this.$el('x')) {
+ this.$el('x').setAttr('a', 1)
+ }
+ if (this.$el('y')) {
+ this.$el('y').setAttr('a', 1)
+ }
+ if (this.$el('')) {
+ this.$el('').setAttr('a', 1)
+ }
+ if (this.$el('0')) {
+ this.$el('0').setAttr('a', 1)
+ }
+ if (this.$el(0)) {
+ this.$el(0).setAttr('b', 1)
+ }
+ }
+ }
+
+;module.exports.template = {
+ "type": "div",
+ "children": [
+ {
+ "type": "text",
+ "id": "x",
+ "attr": {
+ "value": "Hello"
+ }
+ },
+ {
+ "type": "text",
+ "id": "0",
+ "attr": {
+ "value": "Hello"
+ }
+ },
+ {
+ "type": "text",
+ "id": '',
+ "attr": {
+ "value": "Hello"
+ }
+ },
+ {
+ "type": "text",
+ "id": null,
+ "attr": {
+ "value": "Hello"
+ }
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/id')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/if-repeat.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/if-repeat.output.js b/test/js-framework/case/basic/if-repeat.output.js
new file mode 100644
index 0000000..5265727
--- /dev/null
+++ b/test/js-framework/case/basic/if-repeat.output.js
@@ -0,0 +1,13 @@
+{
+ type: 'container',
+ children: [{
+ type: 'text',
+ style: {
+ color: '#FF0000',
+ fontSize: 26
+ },
+ attr: {
+ value: 'Hello World1'
+ }
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/if-repeat.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/if-repeat.source.js b/test/js-framework/case/basic/if-repeat.source.js
new file mode 100644
index 0000000..aa62931
--- /dev/null
+++ b/test/js-framework/case/basic/if-repeat.source.js
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/if-repeat', function (require, exports, module) {
+
+;
+ module.exports = {
+ data: function () {return {
+ titlelist: [
+ {showTitle: true, title: 'Hello World1'},
+ {showTitle: false, title: 'Hello World2'}
+ ]
+ }}
+ }
+
+
+;module.exports.style = {
+ "title": {
+ "fontSize": 26,
+ "color": "#FF0000"
+ }
+}
+
+;module.exports.template = {
+ "type": "container",
+ "children": [
+ {
+ "type": "text",
+ "repeat": function () {return this.titlelist},
+ "shown": function () {return this.showTitle},
+ "classList": [
+ "title"
+ ],
+ "attr": {
+ "value": function () {return this.title}
+ }
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/if-repeat')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/if-root.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/if-root.output.js b/test/js-framework/case/basic/if-root.output.js
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/test/js-framework/case/basic/if-root.output.js
@@ -0,0 +1 @@
+{}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/if-root.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/if-root.source.js b/test/js-framework/case/basic/if-root.source.js
new file mode 100644
index 0000000..ca94316
--- /dev/null
+++ b/test/js-framework/case/basic/if-root.source.js
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/if-root', function (require, exports, module) {
+
+;module.exports = {
+ data: function () {return {
+ visible: true,
+ }}
+}
+
+;module.exports.template = {
+ "type": "container",
+ "shown": function () {return this.visible},
+ "children": [
+ {
+ "type": "text",
+ "attr": {
+ "value": "container"
+ }
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/if-root')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/if.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/if.output.js b/test/js-framework/case/basic/if.output.js
new file mode 100644
index 0000000..03dbeae
--- /dev/null
+++ b/test/js-framework/case/basic/if.output.js
@@ -0,0 +1,13 @@
+{
+ type: 'container',
+ children: [{
+ type: 'text',
+ style: {
+ color: '#FF0000',
+ fontSize: 26
+ },
+ attr: {
+ value: 'Hello World'
+ }
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/if.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/if.source.js b/test/js-framework/case/basic/if.source.js
new file mode 100644
index 0000000..3ebb80c
--- /dev/null
+++ b/test/js-framework/case/basic/if.source.js
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/if', function (require, exports, module) {
+
+;
+ module.exports = {
+ data: function () {return {
+ showTitle: true,
+ title: 'Hello World'
+ }}
+ }
+
+
+;module.exports.style = {
+ "title": {
+ "fontSize": 26,
+ "color": "#FF0000"
+ }
+}
+
+;module.exports.template = {
+ "type": "container",
+ "children": [
+ {
+ "type": "text",
+ "shown": function () {return this.showTitle},
+ "classList": [
+ "title"
+ ],
+ "attr": {
+ "value": function () {return this.title}
+ }
+ }
+ ]
+}
+
+;})
+
+// require module
+
+bootstrap('@weex-component/if')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/promise.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/promise.output.js b/test/js-framework/case/basic/promise.output.js
new file mode 100644
index 0000000..07b17c9
--- /dev/null
+++ b/test/js-framework/case/basic/promise.output.js
@@ -0,0 +1,3 @@
+{
+ type: 'container'
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/promise.source.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/promise.source.js b/test/js-framework/case/basic/promise.source.js
new file mode 100644
index 0000000..67554ba
--- /dev/null
+++ b/test/js-framework/case/basic/promise.source.js
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+define('@weex-component/foo', function (require, exports, module) {
+new Promise(function (fulfill, reject){
+ fulfill(1)
+})
+Promise.all([Promise.resolve(1)])
+;
+ module.exports = {
+ data: function () {
+ return {
+ x: 1
+ }
+ }
+ }
+
+
+;module.exports.style = {
+ "a": {
+ "fontSize": 12
+ }
+}
+
+;module.exports.template = {
+ "type": "container"
+}
+
+;})
+
+
+bootstrap('@weex-component/foo')
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/51dd277e/test/js-framework/case/basic/ready.output.js
----------------------------------------------------------------------
diff --git a/test/js-framework/case/basic/ready.output.js b/test/js-framework/case/basic/ready.output.js
new file mode 100644
index 0000000..39c15f3
--- /dev/null
+++ b/test/js-framework/case/basic/ready.output.js
@@ -0,0 +1,11 @@
+{
+ "children": [
+ {
+ "attr": {
+ "value": "1"
+ },
+ "type": "text"
+ }
+ ],
+ "type": "container"
+}
\ No newline at end of file