@aiot-toolkit/velasim
Version:
vela for sim
779 lines (732 loc) • 24 kB
JavaScript
export default function(global, globalThis, window, $app_exports$){
globalThis = undefined;
global = typeof window === "undefined" ? global.__proto__ : window ;
var createPageHandler = function() {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/script-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/module-loader.js!./node_modules/babel-loader/lib/index.js?cwd=/home/zhoubingqing/workspace/vela/vela-demo-quality&cacheDirectory&plugins[]=/home/zhoubingqing/workspace/vela/vela-demo-quality/node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/home/zhoubingqing/workspace/vela/vela-demo-quality/node_modules/@aiot-toolkit/packager/babel.config.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/access-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=script!./node_modules/@aiot-toolkit/packager/lib/loaders/inject-suite-loader.js?hookName=onReady!./src/widgets/swiper/origin/index.ux?uxType=page":
/*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/script-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/module-loader.js!./node_modules/babel-loader/lib/index.js?cwd=/home/zhoubingqing/workspace/vela/vela-demo-quality&cacheDirectory&plugins[]=/home/zhoubingqing/workspace/vela/vela-demo-quality/node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/home/zhoubingqing/workspace/vela/vela-demo-quality/node_modules/@aiot-toolkit/packager/babel.config.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/access-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=script!./node_modules/@aiot-toolkit/packager/lib/loaders/inject-suite-loader.js?hookName=onReady!./src/widgets/swiper/origin/index.ux?uxType=page ***!
\***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
module.exports = function __scriptModule__ (module, exports, $app_require$){"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _index = _interopRequireDefault2(__webpack_require__(/*! ./test/widgets/swiper/origin/index.js */ "./test/widgets/swiper/origin/index.js"));
function _interopRequireDefault2(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = {
private: {
swiperChange: {
curIndex: ''
},
swiperDynamic: {
autoplay: true,
interval: 1000,
indicator: true
},
checkedValue: true,
currentProg: 1000,
marginVaule: 0,
indicatorTop: 0
},
onInit() {
this.$page.setTitleBar({
text: 'swiper'
});
},
onSwiperChange(evt) {
this.swiperChange.curIndex = evt.index;
},
invokeSwipeTo() {
this.$element('swiperMethod').swipeTo({
index: 1
});
},
toggleIndicator() {
this.swiperDynamic.indicator = !this.swiperDynamic.indicator;
},
toggleAutoplay() {
this.swiperDynamic.autoplay = !this.swiperDynamic.autoplay;
},
onSliderChange(evt) {
this.swiperDynamic.interval = evt.progress;
},
getCheckedValue(evt) {
this.checkedValue = evt.checked;
},
sliderChange(evt) {
this.currentProg = evt.progress;
},
progressChange(value, evt) {
this[value] = evt.progress;
},
onReady() {
this.$options = this._options || this.$options;
if (this.$options._descriptor) {
this.$options._descriptor['back'] = {
access: 'public'
};
}
__webpack_require__.g.CASE_TEST_START = __webpack_require__.g.CASE_TEST_START || 1000;
__webpack_require__.g.CASE_TEST_TIMEOUT = __webpack_require__.g.CASE_TEST_TIMEOUT || 2000;
__webpack_require__.g.mocha = new Mocha({
reporter: 'json',
timeout: __webpack_require__.g.CASE_TEST_TIMEOUT
});
mocha.ui('bdd');
mocha.suite.emit('pre-require', __webpack_require__.g, null, mocha);
setTimeout(() => {
typeof _index.default === 'function' && (0, _index.default)(this);
const mochaRunner = mocha.run(() => {
if (mochaRunner) {
mochaRunner.testResults.stats.title = mocha.suite.suites && mocha.suite.suites[0] && mocha.suite.suites[0].title;
console.info('testResults: ', JSON.stringify(mochaRunner.testResults));
pushData('pageTestList', mochaRunner.testResults);
const stats = mochaRunner.testResults.stats;
}
if (this.back !== 'false') {
console.info('拥有关联测试用例,测试完毕,返回到之前的页面');
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var _system = _interopRequireDefault($app_require$('@app-module/system.router'));
_system.default.back();
}
});
}, __webpack_require__.g.CASE_TEST_START);
}
};
exports.default = _default;
const moduleOwn = exports.default || module.exports;
const accessors = ['public', 'protected', 'private'];
if (moduleOwn.data && accessors.some(function (acc) {
return moduleOwn[acc];
})) {
throw new Error('页面VM对象中的属性data不可与"' + accessors.join(',') + '"同时存在,请使用private替换data名称');
} else if (!moduleOwn.data) {
moduleOwn.data = {};
moduleOwn._descriptor = {};
accessors.forEach(function (acc) {
const accType = typeof moduleOwn[acc];
if (accType === 'object') {
moduleOwn.data = Object.assign(moduleOwn.data, moduleOwn[acc]);
for (const name in moduleOwn[acc]) {
moduleOwn._descriptor[name] = {
access: acc
};
}
} else if (accType === 'function') {
console.warn('页面VM对象中的属性' + acc + '的值不能是函数,请使用对象');
}
});
}}
/***/ }),
/***/ "./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=style!./src/widgets/swiper/origin/index.ux?uxType=page":
/*!***********************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=style!./src/widgets/swiper/origin/index.ux?uxType=page ***!
\***********************************************************************************************************************************************************************************************************************************/
/***/ ((module) => {
module.exports = [
[
[
[
0,
"hap-page"
]
],
{
"flexDirection": "column",
"flex": 1,
"backgroundColor": "#fbf9fe"
}
],
[
[
[
0,
"hap-comp"
]
],
{
"flexDirection": "column",
"flex": 1,
"backgroundColor": "#fbf9fe"
}
],
[
[
[
0,
"hap-row"
]
],
{
"flexDirection": "column",
"borderTopWidth": "1px",
"borderTopColor": "rgb(187,187,187)"
}
],
[
[
[
0,
"hap-row-inline"
]
],
{
"borderTopWidth": "1px",
"borderTopColor": "rgb(187,187,187)"
}
],
[
[
[
0,
"hap-row-desc"
]
],
{
"color": "#3d3d3f",
"paddingTop": "10px",
"paddingRight": "0px",
"paddingBottom": "10px",
"paddingLeft": "20px",
"backgroundColor": "#f1ebeb"
}
],
[
[
[
0,
"hap-row-desc-inline"
]
],
{
"color": "#3d3d3f",
"paddingTop": "10px",
"paddingRight": "0px",
"paddingBottom": "10px",
"paddingLeft": "20px",
"backgroundColor": "#f1ebeb",
"width": "300px"
}
],
[
[
[
0,
"hap-row-container"
]
],
{
"marginTop": "50px",
"marginRight": "60px",
"marginBottom": "50px",
"marginLeft": "60px",
"flexDirection": "column"
}
],
[
[
[
0,
"hap-row-content"
]
],
{
"flexDirection": "column",
"backgroundColor": "#ffffff",
"paddingTop": "30px",
"paddingRight": "30px",
"paddingBottom": "30px",
"paddingLeft": "30px",
"marginBottom": "50px"
}
],
[
[
[
0,
"btn-l"
]
],
{
"height": "80px",
"textAlign": "center",
"marginTop": "50px",
"marginRight": "0px",
"marginBottom": "50px",
"marginLeft": "0px",
"color": "#ffffff",
"fontSize": "30px",
"backgroundColor": "#0faeff"
}
],
[
[
[
0,
"btn-m"
]
],
{
"height": "80px",
"textAlign": "center",
"borderRadius": "5px",
"marginTop": "50px",
"marginRight": "30px",
"marginBottom": "50px",
"marginLeft": "30px",
"color": "#ffffff",
"fontSize": "30px",
"backgroundColor": "#0faeff"
}
],
[
[
[
0,
"btn-s"
]
],
{
"height": "80px",
"textAlign": "center",
"borderRadius": "5px",
"marginTop": "50px",
"marginRight": "100px",
"marginBottom": "50px",
"marginLeft": "100px",
"color": "#ffffff",
"fontSize": "30px",
"backgroundColor": "#0faeff"
}
],
[
[
[
0,
"hap-row-content"
],
[
0,
"btn-s"
]
],
{
"height": "80px",
"textAlign": "center",
"borderRadius": "5px",
"marginTop": "50px",
"marginRight": "100px",
"marginBottom": "50px",
"marginLeft": "100px",
"color": "#ffffff",
"fontSize": "30px",
"backgroundColor": "#0faeff"
}
],
[
[
[
0,
"flex-dir-col"
]
],
{
"flexDirection": "column"
}
],
[
[
[
0,
"flex-dir-row"
]
],
{
"flexDirection": "row"
}
],
[
[
[
0,
"hap-m-r-20"
]
],
{
"marginRight": "20px"
}
],
[
[
[
0,
"swiper"
]
],
{
"height": "300px",
"width": "600px",
"marginLeft": "75px"
}
],
[
[
[
1,
"swiper-animation"
]
],
{
"animationTimingFunction": "linear",
"pageAnimationName": "anim",
"pageTransformOrigin": "1000px 1000px"
}
],
[
[
[
3,
"anim"
]
],
{
"keyframes": "[{\"transform\":{\"rotateX\":\"50deg\"},\"time\":0},{\"opacity\":0.1,\"time\":0},{\"transform\":{\"rotateX\":\"0deg\"},\"time\":100},{\"opacity\":1,\"time\":100}]"
}
],
[
[
[
0,
"swiper"
],
[
2,
"text"
]
],
{
"backgroundColor": "#FFC0CB"
}
],
[
[
[
0,
"set-indicator"
]
],
{
"indicatorColor": "#d3d3d3",
"indicatorSelectedColor": "#FF0000",
"indicatorSize": "10px"
}
],
[
[
[
0,
"slider"
]
],
{
"width": "500px",
"height": "100px",
"color": "#ffff00",
"selectedColor": "#09ba07"
}
],
[
[
[
0,
"swiper-slider"
]
],
{
"color": "#FFFFFF",
"paddingLeft": "20px",
"width": "100%"
}
],
[
[
[
0,
"hap-content"
]
],
{
"justifyContent": "space-between",
"marginBottom": "20px"
}
]
]
/***/ }),
/***/ "./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/template-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=template!./src/widgets/swiper/origin/index.ux?uxType=page&":
/*!***********************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/template-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=template!./src/widgets/swiper/origin/index.ux?uxType=page& ***!
\***********************************************************************************************************************************************************************************************************************/
/***/ ((module) => {
module.exports = function (vm) {
const _vm_ = vm || this
return aiot.__ce__("div", {
"classList": [
"hap-page"
]
}, [
aiot.__ce__("div", {
"classList": [
"hap-row"
]
}, [
aiot.__ce__("text", {
"classList": [
"hap-row-desc"
],
"value": "默认"
}),
aiot.__ce__("swiper", {
"id": "uiSwiper1",
"classList": [
"swiper"
]
}, [
aiot.__ce__("text", {
"classList": [
"color-1"
],
"value": "A"
}),
aiot.__ce__("text", {
"classList": [
"color-2"
],
"value": "B"
}),
aiot.__ce__("text", {
"classList": [
"color-3"
],
"value": "C"
})
])
]),
aiot.__ce__("div", {
"classList": [
"hap-row"
]
}, [
aiot.__ce__("text", {
"classList": [
"hap-row-desc"
],
"value": "修改默认值"
}),
aiot.__ce__("switch", {
"id": "changeCheckedValue",
"checked": function () {return _vm_.checkedValue},
"events": {
"change": function (evt) {_vm_.getCheckedValue(evt)}
}
}),
aiot.__ce__("swiper", {
"id": "uiSwiper2",
"enableswipe": "false",
"loop": function () {return _vm_.checkedValue},
"classList": [
"swiper",
"set-indicator"
]
}, [
aiot.__ce__("text", {
"classList": [
"color-1"
],
"value": "A"
}),
aiot.__ce__("text", {
"classList": [
"color-2"
],
"value": "B"
}),
aiot.__ce__("text", {
"classList": [
"color-3"
],
"value": "C"
})
])
]),
aiot.__ce__("div", {
"classList": [
"hap-row"
]
}, [
aiot.__ce__("text", {
"classList": [
"hap-row-desc"
],
"value": function () {return '' + '事件change: ' + (_vm_.swiperChange.curIndex)}
}),
aiot.__ce__("swiper", {
"id": "uiSwiper3",
"autoplay": function () {return 'true'},
"classList": [
"swiper"
],
"events": {
"change": function (evt) {_vm_.onSwiperChange(evt)}
}
}, [
aiot.__ce__("text", {
"classList": [
"color-1"
],
"value": "A"
}),
aiot.__ce__("text", {
"classList": [
"color-2"
],
"value": "B"
}),
aiot.__ce__("text", {
"classList": [
"color-3"
],
"value": "C"
})
])
])
])
}
/***/ }),
/***/ "./src/widgets/swiper/origin/index.ux?uxType=page":
/*!********************************************************!*\
!*** ./src/widgets/swiper/origin/index.ux?uxType=page ***!
\********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var $app_style$ = __webpack_require__(/*! !../../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!../../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=style!./index.ux?uxType=page */ "./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=style!./src/widgets/swiper/origin/index.ux?uxType=page")
var $app_script$ = __webpack_require__(/*! !../../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/script-loader.js!../../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/module-loader.js!../../../../node_modules/babel-loader/lib/index.js?cwd=/home/zhoubingqing/workspace/vela/vela-demo-quality&cacheDirectory&plugins[]=/home/zhoubingqing/workspace/vela/vela-demo-quality/node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/home/zhoubingqing/workspace/vela/vela-demo-quality/node_modules/@aiot-toolkit/packager/babel.config.js!../../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/access-loader.js!../../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=script!../../../../node_modules/@aiot-toolkit/packager/lib/loaders/inject-suite-loader.js?hookName=onReady!./index.ux?uxType=page */ "./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/script-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/module-loader.js!./node_modules/babel-loader/lib/index.js?cwd=/home/zhoubingqing/workspace/vela/vela-demo-quality&cacheDirectory&plugins[]=/home/zhoubingqing/workspace/vela/vela-demo-quality/node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/home/zhoubingqing/workspace/vela/vela-demo-quality/node_modules/@aiot-toolkit/packager/babel.config.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/access-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=script!./node_modules/@aiot-toolkit/packager/lib/loaders/inject-suite-loader.js?hookName=onReady!./src/widgets/swiper/origin/index.ux?uxType=page")
var $app_template$ = __webpack_require__(/*! !../../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/template-loader.js!../../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=template!./index.ux?uxType=page& */ "./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/template-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=template!./src/widgets/swiper/origin/index.ux?uxType=page&")
$app_script$({}, $app_exports$, $app_require$);
$app_exports$.default.template = $app_template$;
$app_exports$.default.style = $app_style$;
module.exports = $app_exports$.default;
/***/ }),
/***/ "./test/widgets/swiper/origin/index.js":
/*!*********************************************!*\
!*** ./test/widgets/swiper/origin/index.js ***!
\*********************************************/
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.default = _default;
/**
* 测试脚本
* @desc
* @see {@link http://chaijs.com/api/bdd/} chai断言
* @param vm 页面对应的ViewModel
* @desc 断言函数调用时必须传递第三个参数,说明断言业务意义
*/
function _default(vm) {
describe('组件swiper', function () {
it('默认:属性', function () {
const elNode = vm.$element('uiSwiper1');
const uiNode1 = normalize(nodeAttr(elNode));
assert.strictEqual(uiNode1.index, 0, 'index正确');
assert.strictEqual(uiNode1.autoplay, false, 'autoplay正确');
assert.strictEqual(uiNode1.indicator, true, 'indicator正确');
assert.strictEqual(uiNode1.loop, true, 'loop正确');
assert.strictEqual(uiNode1.vertical, false, 'vertical正确');
assert.strictEqual(uiNode1.previousmargin, uiNode1.nextmargin, '前后边距正确');
assert.strictEqual(uiNode1.enableswipe, true, 'enableswipe正确');
});
it('默认:样式', function () {
const elNode = vm.$element('uiSwiper1');
const uiNode1 = normalize(nodeStyle(elNode));
assert.strictEqual(uiNode1.indicatorSelectedColor, '#33b4ff', 'indicatorSelectedColor正确');
assert.strictEqual(uiNode1.indicatorSize, 20, 'indicatorSize正确');
});
it('设置的属性,样式在VDOM生效', async function () {
const elNode = vm.$element('uiSwiper2');
const uiNode1 = normalize(nodeAttr(elNode));
await vm.$emitElement('change', {
targetId: 'changeCheckedValue'
}, 'changeCheckedValue');
await waitForOK(1 * 1000);
assert.strictEqual(uiNode1.loop, false, 'loop正确');
assert.strictEqual(uiNode1.enableswipe, false, 'enableswipe正确');
assert.strictEqual(uiNode1.indicatorSize, 10, 'indicatorSize正确');
});
it('事件:手动触发点击事件并响应', async function (done) {
setTimeout(done, 500);
await vm.$emitElement('change', {
targetId: 'uiSwiper3'
}, 'uiSwiper3');
await waitForOK(1 * 1000);
assert.include([0, 1, 2], vm.swiperChange.curIndex, '当前显示的组件索引正确');
});
});
}
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/global */
/******/ (() => {
/******/ __webpack_require__.g = (function() {
/******/ if (typeof globalThis === 'object') return globalThis;
/******/ try {
/******/ return this || new Function('return this')();
/******/ } catch (e) {
/******/ if (typeof window === 'object') return window;
/******/ }
/******/ })();
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
/******/ var __webpack_exports__ = __webpack_require__("./src/widgets/swiper/origin/index.ux?uxType=page");
/******/
/******/ })()
;
};
return createPageHandler();
};