Repository: incubator-weex Updated Branches: refs/heads/0.16-dev 6b9f23b10 -> 5f5d67436
* [test] add dom tc Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/c63f64a6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/c63f64a6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/c63f64a6 Branch: refs/heads/0.16-dev Commit: c63f64a6aa9104b424a7222e28ba6fee1ad454b0 Parents: 58441fa Author: gurisxie <279483...@qq.com> Authored: Thu Aug 31 15:34:30 2017 +0800 Committer: gurisxie <279483...@qq.com> Committed: Thu Aug 31 15:34:30 2017 +0800 ---------------------------------------------------------------------- test/pages/modules/dom-common.vue | 87 ++++++++++++++++++++++++++++ test/pages/modules/dom-update.vue | 78 +++++++++++++++++++++++++ test/pages/modules/downgrade-event.vue | 2 +- test/scripts/modules/dom-common.test.js | 36 ++++++++++++ test/scripts/modules/dom-update.test.js | 51 ++++++++++++++++ 5 files changed, 253 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c63f64a6/test/pages/modules/dom-common.vue ---------------------------------------------------------------------- diff --git a/test/pages/modules/dom-common.vue b/test/pages/modules/dom-common.vue new file mode 100644 index 0000000..a090f24 --- /dev/null +++ b/test/pages/modules/dom-common.vue @@ -0,0 +1,87 @@ +<template> + <div> + <panel title = 'dom-common' :padding-body='0'> + <div v-if="show"> + <text class="font">show text</text> + </div> + <div> + <text class="font">{{jsonObj.firstName}}-{{jsonObj.lastName}}</text> + <text class="font">{{runMethod()}}</text> + </div> + <div> + <text :style='styleObj'>styleChange</text> + <text :class="[activeClass, errorClass]">classChange</text> + </div> + <div v-for="txt in textList"> + <text class="font">{{txt}}</text> + </div> + </panel> + <wxc-desc> + <text class='desc'> +æµè¯ç¹ï¼ + * domç¸å ³æä½ + +æµè¯æ¹å¼ï¼ + * classæä¸æ¯æobjçåæ³ï¼åªæ¯ææ°ç»åæ³ + </text> + </wxc-desc> + </div> +</template> +<script> + module.exports = { + data :function(){ + return { + textList:[], + show:false, + jsonObj:{ + firstName: 'Jack', + lastName: 'Ma' + }, + styleObj:{ + fontSize:30 + }, + activeClass:'font100', + errorClass:'colorRed' + } + }, + components: { + "wxc-desc":require('../include/wxc-desc.vue'), + panel: require('../include/panel.vue'), + button: require('../include/button.vue'), + }, + created: function() { + this.promiseM().then(() =>{ + this.textList.push('promise support'); + }); + setTimeout(()=>{ + this.show = true; + this.jsonObj.firstName = 'Zechang' + this.jsonObj.lastName = 'Xie' + this.styleObj.fontSize = 100; + this.styleObj.color = 'red'; + },500); + + }, + methods: { + promiseM: function() { + return Promise.resolve('') + }, + runMethod:function(){ + return 'runMethod'; + } + } + } +</script> + +<style scoped> + .font100{font-size: 100;} + .font{font-family: Times New Roman;font-size:30} + .origin{background-color: #FFFFDF;width: 200;height: 50;} + .mr-base{ + margin: 10px; + } + .desc{ + color:#aa0000; + font-size: 30px; + } +</style> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c63f64a6/test/pages/modules/dom-update.vue ---------------------------------------------------------------------- diff --git a/test/pages/modules/dom-update.vue b/test/pages/modules/dom-update.vue new file mode 100644 index 0000000..9401036 --- /dev/null +++ b/test/pages/modules/dom-update.vue @@ -0,0 +1,78 @@ +<template> + <div> + <panel title = 'dom-update' :padding-body='0'> + <div style='flex-direction:row'> + <button class='mr-base' type="info" size="middle" value="push" @click.native="push"></button> + <button class='mr-base' type="info" size="middle" value="concat" @click.native="concat"></button> + <button class='mr-base' type="info" size="middle" value="unshift" @click.native="unshift"></button> + </div> + <div style='flex-direction:row'> + <button class='mr-base' type="info" size="middle" value="pop" @click.native="pop"></button> + <button class='mr-base' type="info" size="middle" value="shift" @click.native="shift"></button> + </div> + <panel title='æ ¡éªç»æï¼'> + <div v-for="txt in textList"> + <text class="font">{{txt}}</text> + </div> + </panel> + </panel> + <wxc-desc> + <text class='desc'> +æµè¯ç¹ï¼ + * + +æµè¯æ¹å¼ï¼ + * concat->push->unshift->shift->pop + </text> + </wxc-desc> + </div> +</template> +<script> + module.exports = { + data :function(){ + return { + textList:[], + textList2:[] + } + }, + components: { + "wxc-desc":require('../include/wxc-desc.vue'), + panel: require('../include/panel.vue'), + button: require('../include/button.vue'), + }, + methods : { + push:function() { + this.textList.push('List-' + this.textList.length) + }, + concat:function() { + this.textList = this.textList.concat(this.textList2) + }, + unshift:function() { + this.textList.unshift('List-unshift-' + this.textList.length) + }, + pop:function() { + this.textList.pop() + }, + shift:function() { + this.textList.shift() + } + }, + created: function() { + for(var i = 0; i<5; i++) { + this.textList2.push('List2-' + this.textList2.length) + } + } + } +</script> + +<style scoped> + .font{font-family: Times New Roman;font-size:20} + .origin{background-color: #FFFFDF;width: 200;height: 50;} + .mr-base{ + margin: 10px; + } + .desc{ + color:#aa0000; + font-size: 30px; + } +</style> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c63f64a6/test/pages/modules/downgrade-event.vue ---------------------------------------------------------------------- diff --git a/test/pages/modules/downgrade-event.vue b/test/pages/modules/downgrade-event.vue index 4669d96..432fc8e 100644 --- a/test/pages/modules/downgrade-event.vue +++ b/test/pages/modules/downgrade-event.vue @@ -1,6 +1,6 @@ <template> <div> - <panel title = 'clipboard-event' :padding-body='0'> + <panel title = 'downgrade-event' :padding-body='0'> <div style='flex-direction:row'> <button class='mr-base' type="info" size="middle" value="setItem" @click.native="setItem"></button> <button class='mr-base' type="info" size="middle" value="getItem" @click.native="getItem"></button> http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c63f64a6/test/scripts/modules/dom-common.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/modules/dom-common.test.js b/test/scripts/modules/dom-common.test.js new file mode 100644 index 0000000..32b3e7b --- /dev/null +++ b/test/scripts/modules/dom-common.test.js @@ -0,0 +1,36 @@ +'use strict'; + +var _ = require('macaca-utils'); +var assert = require('chai').assert +var wd = require('weex-wd') +var path = require('path'); +var os = require('os'); +var util = require("../util.js"); + +var goal = 'dom-common'; +var timeout = util.getGETActionWaitTimeMills(); +describe('weex '+goal+' test', function () { + this.timeout(util.getTimeoutMills()); + var driver = util.createDriver(wd); + + beforeEach(function () { + return util.init(driver) + .get(util.getPage('/modules/'+goal+'.js')) + }); + + afterEach(function () { + return util.quit(driver); + }) + + it('#1 '+goal + ' event,add and remove dom', () => { + return driver + .waitForElementByName(goal, timeout, 2000) + .waitForElementByName('show text', timeout, 2000) + .waitForElementByName('Zechang-Xie', timeout, 2000) + .waitForElementByName('runMethod', timeout, 2000) + .waitForElementByName('promise support', timeout, 2000) + //TODO rect compare + .waitForElementByName('styleChange', timeout, 2000) + .waitForElementByName('classChange', timeout, 2000) + }) +}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c63f64a6/test/scripts/modules/dom-update.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/modules/dom-update.test.js b/test/scripts/modules/dom-update.test.js new file mode 100644 index 0000000..dcce459 --- /dev/null +++ b/test/scripts/modules/dom-update.test.js @@ -0,0 +1,51 @@ +'use strict'; + +var _ = require('macaca-utils'); +var assert = require('chai').assert +var wd = require('weex-wd') +var path = require('path'); +var os = require('os'); +var util = require("../util.js"); + +var goal = 'dom-update'; +var timeout = util.getGETActionWaitTimeMills(); +describe('weex '+goal+' test', function () { + this.timeout(util.getTimeoutMills()); + var driver = util.createDriver(wd); + + beforeEach(function () { + return util.init(driver) + .get(util.getPage('/modules/'+goal+'.js')) + }); + + afterEach(function () { + return util.quit(driver); + }) + + it('#1 '+goal + ' event,add and remove dom', () => { + return driver + .waitForElementByName(goal, timeout, 2000) + .waitForElementByName('concat', timeout, 2000) + .click() + .waitForElementByName('List2-0', timeout, 2000) + .waitForElementByName('List2-4', timeout, 2000) + .waitForElementByName('push', timeout, 2000) + .click() + .waitForElementByName('List-5', timeout, 2000) + .waitForElementByName('unshift', timeout, 2000) + .click() + .waitForElementByName('List-unshift-6', timeout, 2000) + //TODO å¤æviewé«åº¦ + .waitForElementByName('shift', timeout, 2000) + .click().sleep(1000) + .elementByNameOrNull('List-unshift-6').then((els)=>{ + assert.equal(els, null); + return driver.waitForElementByName('pop', timeout, 2000) + .click().sleep(1000) + .elementByNameOrNull('List-5').then((els1)=>{ + assert.equal(els1, null); + return driver; + }) + }) + }) +}); \ No newline at end of file