@aiot-toolkit/velasim
Version:
vela for sim
1,068 lines (1,027 loc) • 44 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/div/flex/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/div/flex/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/div/flex/index.js */ "./test/widgets/div/flex/index.js"));
function _interopRequireDefault2(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = {
private: {
flexStyleArray: [['row', 'nowrap', 'flex-start', 'stretch'], ['row', 'wrap', 'flex-start', 'stretch'], ['row', 'wrap-reverse', 'flex-start', 'stretch'], ['row', 'nowrap', 'flex-end', 'stretch'], ['row', 'nowrap', 'center', 'stretch'], ['row', 'nowrap', 'space-between', 'stretch'], ['row', 'nowrap', 'flex-start', 'flex-start'], ['row', 'nowrap', 'flex-start', 'flex-end'], ['row', 'nowrap', 'flex-start', 'center'], ['column', 'nowrap', 'flex-start', 'stretch'], ['column', 'wrap', 'flex-start', 'stretch'], ['column', 'wrap-reverse', 'flex-start', 'stretch'], ['column', 'nowrap', 'flex-end', 'stretch'], ['column', 'nowrap', 'center', 'stretch'], ['column', 'nowrap', 'space-between', 'stretch'], ['column', 'nowrap', 'flex-start', 'flex-start'], ['column', 'nowrap', 'flex-start', 'flex-end'], ['column', 'nowrap', 'flex-start', 'center']],
flexStyle1: [],
flexStyle2: [],
flexStyle3: [],
justifyContentList: ['flex-start', 'flex-end', 'center', 'space-between', 'space-around'],
alignselfList: ['auto', 'stretch', 'center', 'flex-start', 'flex-end', 'baseline']
},
changeFlexStyle1(index) {
if (index >= 0 && index <= this.flexStyleArray.length - 1) {
this.flexStyle1 = this.flexStyleArray[index];
}
},
changeFlexStyle2(index) {
if (index >= 0 && index <= this.flexStyleArray.length - 1) {
this.flexStyle2 = this.flexStyleArray[index];
}
},
changeFlexStyle3(index) {
if (index >= 0 && index <= this.flexStyleArray.length - 1) {
this.flexStyle3 = this.flexStyleArray[index];
}
},
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/div/flex/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/div/flex/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,
"item-blue"
]
],
{
"width": "200px",
"textAlign": "center",
"color": "#FFFFFF",
"backgroundColor": "#0faeff"
}
],
[
[
[
0,
"item-red"
]
],
{
"width": "200px",
"height": "200px",
"textAlign": "center",
"color": "#FFFFFF",
"backgroundColor": "#f76160"
}
],
[
[
[
0,
"item-green"
]
],
{
"height": "100px",
"textAlign": "center",
"color": "#FFFFFF",
"backgroundColor": "#09ba07"
}
],
[
[
[
0,
"main"
]
],
{
"width": "300px",
"height": "300px",
"borderTopWidth": "1px",
"borderRightWidth": "1px",
"borderBottomWidth": "1px",
"borderLeftWidth": "1px",
"borderStyle": "solid",
"borderTopColor": "#000000",
"borderRightColor": "#000000",
"borderBottomColor": "#000000",
"borderLeftColor": "#000000",
"display": "flex",
"alignItems": "flex-start"
}
]
]
/***/ }),
/***/ "./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/div/flex/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/div/flex/index.ux?uxType=page& ***!
\******************************************************************************************************************************************************************************************************************/
/***/ ((module) => {
module.exports = function (vm) {
const _vm_ = vm || this
return aiot.__ce__("div", {
"classList": [
"hap-page"
]
}, [
aiot.__ce__("div", {
"id": "uiFlex1",
"style": {
"height": "500px",
"flexDirection": function () {return _vm_.flexStyle1[0]},
"flexWrap": function () {return _vm_.flexStyle1[1]},
"justifyContent": function () {return _vm_.flexStyle1[2]},
"alignItems": function () {return _vm_.flexStyle1[3]}
}
}, [
aiot.__ce__("text", {
"classList": [
"item-blue"
],
"value": "A"
}),
aiot.__ce__("text", {
"classList": [
"item-blue"
],
"value": "B"
}),
aiot.__ce__("text", {
"classList": [
"item-blue"
],
"value": "C"
}),
aiot.__ce__("text", {
"classList": [
"item-blue"
],
"value": "D"
}),
aiot.__ce__("text", {
"classList": [
"item-blue"
],
"value": "E"
}),
aiot.__ce__("text", {
"classList": [
"item-blue"
],
"value": "F"
}),
aiot.__ce__("text", {
"classList": [
"item-blue"
],
"value": "G"
}),
aiot.__ce__("text", {
"classList": [
"item-blue"
],
"value": "H"
})
]),
aiot.__ce__("div", {
"id": "uiFlex2",
"style": {
"height": "500px",
"flexDirection": function () {return _vm_.flexStyle2[0]},
"flexWrap": function () {return _vm_.flexStyle2[1]},
"justifyContent": function () {return _vm_.flexStyle2[2]},
"alignItems": function () {return _vm_.flexStyle2[3]}
}
}, [
aiot.__ce__("text", {
"classList": [
"item-red"
],
"value": "A"
}),
aiot.__ce__("text", {
"classList": [
"item-red"
],
"value": "B"
}),
aiot.__ce__("text", {
"classList": [
"item-red"
],
"value": "C"
})
]),
aiot.__ce__("div", {
"id": "uiFlex3",
"style": {
"height": "500px",
"flexDirection": function () {return _vm_.flexStyle3[0]},
"flexWrap": function () {return _vm_.flexStyle3[1]},
"justifyContent": function () {return _vm_.flexStyle3[2]},
"alignItems": function () {return _vm_.flexStyle3[3]}
}
}, [
aiot.__ce__("text", {
"classList": [
"item-green"
],
"value": "A"
}),
aiot.__ce__("text", {
"classList": [
"item-green"
],
"value": "B"
}),
aiot.__ce__("text", {
"classList": [
"item-green"
],
"value": "C"
})
]),
aiot.__cf__({
exp: function () {return _vm_.justifyContentList}
},
function ($idx, $item) {
return [
aiot.__ce__("text", {
"value": function () {return '' + 'justify-content:' + ($item)}
}),
aiot.__ce__("div", {
"style": {
"height": "500px",
"justifyContent": function () {return $item}
}
}, [
aiot.__ce__("text", {
"classList": [
"item-green"
],
"value": "A"
}),
aiot.__ce__("text", {
"classList": [
"item-red"
],
"value": "B"
}),
aiot.__ce__("text", {
"classList": [
"item-blue"
],
"value": "C"
})
])
]}),
aiot.__cf__({
exp: function () {return _vm_.alignselfList}
},
function ($idx, $item) {
return [
aiot.__ce__("text", {
"value": function () {return '' + 'align-self:' + ($item)}
}),
aiot.__ce__("div", {
"classList": [
"main"
]
}, [
aiot.__ce__("div", {
"classList": [
"item-green"
]
}, [
aiot.__ce__("text", {
"value": "A"
})
]),
aiot.__ce__("div", {
"style": {
"width": "100px",
"backgroundColor": "#ADD8E6",
"alignSelf": function () {return $item}
}
}, [
aiot.__ce__("text", {
"value": "B"
})
]),
aiot.__ce__("div", {
"classList": [
"item-blue"
]
}, [
aiot.__ce__("text", {
"value": "C"
})
])
])
]}),
aiot.__ce__("div", {
"classList": [
"hap-row"
]
}, [
aiot.__ce__("text", {
"classList": [
"hap-row-desc"
],
"value": "flex-direction:row-reverse"
}),
aiot.__ce__("div", {
"id": "uiFlex4",
"style": {
"flexDirection": "row-reverse",
"height": "100px"
}
}, [
aiot.__ce__("text", {
"classList": [
"item-blue"
],
"value": "A"
}),
aiot.__ce__("text", {
"classList": [
"item-blue"
],
"value": "B"
}),
aiot.__ce__("text", {
"classList": [
"item-blue"
],
"value": "C"
})
]),
aiot.__ce__("text", {
"classList": [
"hap-row-desc"
],
"value": "flex-direction:column-reverse"
}),
aiot.__ce__("div", {
"id": "uiFlex5",
"style": {
"flexDirection": "column-reverse"
}
}, [
aiot.__ce__("text", {
"classList": [
"item-green"
],
"value": "A"
}),
aiot.__ce__("text", {
"classList": [
"item-green"
],
"value": "B"
}),
aiot.__ce__("text", {
"classList": [
"item-green"
],
"value": "C"
})
])
])
])
}
/***/ }),
/***/ "./src/widgets/div/flex/index.ux?uxType=page":
/*!***************************************************!*\
!*** ./src/widgets/div/flex/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/div/flex/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/div/flex/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/div/flex/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/div/flex/index.js":
/*!****************************************!*\
!*** ./test/widgets/div/flex/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('组件div--flex', () => {
it('flex-direction:row,flex-wrap:nowrap,justify-content:flex-start,align-items:stretch', async () => {
// ['row', 'nowrap', 'flex-start', 'stretch']
vm.changeFlexStyle1(0);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex1')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex1').childNodes[0]));
const uiNodeChild8 = normalize(nodeRect(vm.$element('uiFlex1').childNodes[7]));
assert.strictEqual(uiNodeParent.topStd, uiNodeChild1.topStd, '顶部位置:父元素=子元素1');
assert.strictEqual(uiNodeChild1.topStd, uiNodeChild8.topStd, '顶部位置:子元素1=子元素8');
assert.strictEqual(uiNodeParent.leftStd, uiNodeChild1.leftStd, '左边位置:父元素=子元素1');
assert.strictEqual(uiNodeParent.heightStd, uiNodeChild1.heightStd, '高度:父元素=子元素1');
});
it('flex-direction:row,flex-wrap:wrap,justify-content:flex-start,align-items:stretch', async () => {
// ['row', 'wrap', 'flex-start', 'stretch']
vm.changeFlexStyle1(1);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex1')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex1').childNodes[0]));
const uiNodeChild8 = normalize(nodeRect(vm.$element('uiFlex1').childNodes[7]));
assert.strictEqual(uiNodeParent.topStd, uiNodeChild1.topStd, '顶部位置:父元素=子元素1');
assert.notStrictEqual(uiNodeChild1.topStd, uiNodeChild8.topStd, '顶部位置:子元素1!=子元素8');
assert.strictEqual(uiNodeParent.leftStd, uiNodeChild1.leftStd, '左边位置:父元素=子元素1');
});
it('flex-direction:row,flex-wrap:wrap-reverse,justify-content:flex-start,align-items:stretch', async () => {
// ['row', 'wrap-reverse', 'flex-start', 'stretch']
vm.changeFlexStyle1(2);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex1')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex1').childNodes[0]));
const uiNodeChild8 = normalize(nodeRect(vm.$element('uiFlex1').childNodes[7]));
assert.notStrictEqual(uiNodeChild1.topStd, uiNodeChild8.topStd, '顶部位置:子元素1!=子元素8');
assert.strictEqual(uiNodeParent.leftStd, uiNodeChild1.leftStd, '左边位置:父元素=子元素1');
});
it('flex-direction:row,flex-wrap:nowrap,justify-content:flex-end,align-items:stretch', async () => {
// ['row', 'nowrap', 'flex-end', 'stretch']
vm.changeFlexStyle1(3);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex1')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex1').childNodes[0]));
const uiNodeChild8 = normalize(nodeRect(vm.$element('uiFlex1').childNodes[7]));
assert.strictEqual(uiNodeParent.topStd, uiNodeChild1.topStd, '顶部位置:父元素=子元素1');
assert.strictEqual(uiNodeChild1.topStd, uiNodeChild8.topStd, '顶部位置:子元素1=子元素8');
assert.strictEqual(uiNodeParent.rightStd, uiNodeChild8.rightStd, '右边位置:父元素=子元素8');
assert.strictEqual(uiNodeParent.heightStd, uiNodeChild1.heightStd, '高度:父元素=子元素1');
});
it('flex-direction:row,flex-wrap:nowrap,justify-content:center,align-items:stretch', async () => {
// ['row', 'nowrap', 'center', 'stretch']
vm.changeFlexStyle2(4);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex2')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[0]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[2]));
assert.strictEqual(uiNodeParent.topStd, uiNodeChild1.topStd, '顶部位置:父元素=子元素1');
assert.strictEqual(uiNodeChild1.topStd, uiNodeChild3.topStd, '顶部位置:子元素1=子元素3');
assert.strictEqual(uiNodeChild1.leftStd - uiNodeParent.leftStd, 0, '父子左边距离');
assert.strictEqual(uiNodeChild1.leftStd - uiNodeParent.leftStd, uiNodeParent.rightStd - uiNodeChild3.rightStd, '父子左右边距:左边=右边');
assert.approxEqual(uiNodeChild1.height, 200, '高度:子元素1~200');
});
it('flex-direction:row,flex-wrap:nowrap,justify-content:space-between,align-items:stretch', async () => {
// ['row', 'nowrap', 'space-between', 'stretch']
vm.changeFlexStyle2(5);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex2')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[0]));
const uiNodeChild2 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[1]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[2]));
assert.strictEqual(uiNodeParent.leftStd, uiNodeChild1.leftStd, '左边位置:父元素=子元素1');
assert.strictEqual(uiNodeParent.rightStd, uiNodeChild3.rightStd, '右边位置:父元素=子元素3');
assert.isAbove(uiNodeChild2.leftStd - uiNodeChild1.leftStd, 0, '子元素间边距:>0');
assert.strictEqual(uiNodeChild2.leftStd - uiNodeChild1.rightStd, uiNodeChild3.leftStd - uiNodeChild2.rightStd, '子元素左右边距:12=23');
assert.approxEqual(uiNodeChild1.heightStd, 200, '高度:子元素1~200');
});
it('flex-direction:row,flex-wrap:nowrap,justify-content:flex-start,align-items:flex-start', async () => {
// ['row', 'nowrap', 'flex-start', 'flex-start']
vm.changeFlexStyle2(6);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex2')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[0]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[2]));
assert.strictEqual(uiNodeParent.topStd, uiNodeChild1.topStd, '顶部位置:父元素=子元素1');
assert.strictEqual(uiNodeParent.leftStd, uiNodeChild1.leftStd, '左边位置:父元素=子元素1');
assert.isAbove(uiNodeParent.rightStd, uiNodeChild3.rightStd, '右边位置:父元素>子元素3');
assert.strictEqual(uiNodeParent.heightStd, uiNodeChild1.heightStd, '高度:父元素>子元素1');
});
it('flex-direction:row,flex-wrap:nowrap,justify-content:flex-start,align-items:flex-end', async () => {
// ['row', 'nowrap', 'flex-start', 'flex-end']
vm.changeFlexStyle2(7);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex2')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[0]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[2]));
assert.strictEqual(uiNodeParent.bottomStd, uiNodeChild1.bottomStd, '底部位置:父元素=子元素1');
assert.strictEqual(uiNodeParent.leftStd, uiNodeChild1.leftStd, '左边位置:父元素=子元素1');
assert.isAbove(uiNodeParent.rightStd, uiNodeChild3.rightStd, '右边位置:父元素>子元素3');
assert.isAbove(uiNodeParent.heightStd, uiNodeChild1.heightStd, '高度:父元素>子元素1');
});
it('flex-direction:row,flex-wrap:nowrap,justify-content:flex-start,align-items:center', async () => {
// ['row', 'nowrap', 'flex-start', 'center']
vm.changeFlexStyle2(8);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex2')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[0]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[2]));
assert.isAbove(uiNodeChild1.topStd - uiNodeParent.topStd, 0, '父子顶部距离:>0');
assert.approxEqual(uiNodeChild1.topStd - uiNodeParent.topStd, uiNodeParent.bottomStd - uiNodeChild1.bottomStd, '父子距离:顶部~底部');
assert.strictEqual(uiNodeParent.leftStd, uiNodeChild1.leftStd, '左边位置:父元素=子元素1');
assert.isAbove(uiNodeParent.rightStd, uiNodeChild3.rightStd, '右边位置:父元素>子元素3');
assert.isAbove(uiNodeParent.heightStd, uiNodeChild1.heightStd, '高度:父元素>子元素1');
});
it('flex-direction:column,flex-wrap:nowrap,justify-content:flex-start,align-items:stretch', async () => {
// ['column', 'nowrap', 'flex-start', 'stretch']
vm.changeFlexStyle2(9);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex2')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[0]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[2]));
assert.strictEqual(uiNodeParent.topStd, uiNodeChild1.topStd, '顶部位置:父元素=子元素1');
assert.isAbove(uiNodeParent.bottomStd, uiNodeChild1.bottomStd, '父子底部边距:>0');
assert.strictEqual(uiNodeParent.leftStd, uiNodeChild1.leftStd, '左边位置:父元素=子元素1');
assert.strictEqual(uiNodeChild1.leftStd, uiNodeChild3.leftStd, '左边位置:子元素1=子元素3');
assert.approxEqual(uiNodeChild1.widthStd, 200, '宽度:子元素1~200');
assert.isAbove(uiNodeParent.heightStd, uiNodeChild1.heightStd, '高度:父元素>子元素1');
});
it('flex-direction:column,flex-wrap:wrap,justify-content:flex-start,align-items:stretch', async () => {
// ['column', 'wrap', 'flex-start', 'stretch']
vm.changeFlexStyle2(10);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex2')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[0]));
const uiNodeChild2 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[1]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[2]));
assert.approxEqual(uiNodeChild1.widthStd, 200, '宽度:子元素1~200');
assert.approxEqual(uiNodeChild1.heightStd, 200, '高度:子元素1~200');
assert.strictEqual(uiNodeParent.topStd, uiNodeChild1.topStd, '顶部位置:父元素=子元素1');
assert.strictEqual(uiNodeChild1.topStd, uiNodeChild3.topStd, '顶部位置:子元素1=子元素3');
assert.strictEqual(uiNodeParent.leftStd, uiNodeChild1.leftStd, '左边位置:父元素=子元素1');
assert.strictEqual(uiNodeChild1.leftStd, uiNodeChild2.leftStd, '左边位置:子元素1=子元素2');
assert.notStrictEqual(uiNodeChild1.leftStd, uiNodeChild3.leftStd, '左边位置:子元素1!=子元素3');
});
it('flex-direction:column,flex-wrap:wrap-reverse,justify-content:flex-start,align-items:stretch', async () => {
// ['column', 'wrap-reverse', 'flex-start', 'stretch']
vm.changeFlexStyle2(11);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex2')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[0]));
const uiNodeChild2 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[1]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[2]));
assert.approxEqual(uiNodeChild1.widthStd, 200, '宽度:子元素1~200');
assert.approxEqual(uiNodeChild1.heightStd, 200, '高度:子元素1~200');
assert.strictEqual(uiNodeParent.topStd, uiNodeChild1.topStd, '顶部位置:父元素=子元素1');
assert.strictEqual(uiNodeChild1.topStd, uiNodeChild3.topStd, '顶部位置:子元素1=子元素3');
assert.strictEqual(uiNodeParent.rightStd, uiNodeChild1.rightStd, '右边位置:父元素=子元素1');
assert.strictEqual(uiNodeChild1.rightStd, uiNodeChild2.rightStd, '右边位置:子元素1=子元素2');
assert.notStrictEqual(uiNodeChild1.rightStd, uiNodeChild3.rightStd, '右边位置:子元素1!=子元素3');
});
it('flex-direction:column,flex-wrap:nowrap,justify-content:flex-end,align-items:stretch', async () => {
// ['column', 'nowrap', 'flex-end', 'stretch']
vm.changeFlexStyle3(12);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex3')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex3').childNodes[0]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex3').childNodes[2]));
assert.approxEqual(uiNodeChild1.height, 100, '高度:子元素1~100');
assert.strictEqual(uiNodeParent.widthStd, uiNodeChild1.widthStd, '宽度:父元素=子元素1');
assert.strictEqual(uiNodeChild1.widthStd, uiNodeChild3.widthStd, '宽度:子元素1=子元素3');
assert.strictEqual(uiNodeParent.bottomStd, uiNodeChild3.bottomStd, '底部位置:父元素=子元素1');
});
it('flex-direction:column,flex-wrap:nowrap,justify-content:center,align-items:stretch', async () => {
// ['column', 'nowrap', 'center', 'stretch']
vm.changeFlexStyle3(13);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex3')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex3').childNodes[0]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex3').childNodes[2]));
assert.approxEqual(uiNodeChild1.heightStd, 100, '高度:子元素1~100');
assert.strictEqual(uiNodeParent.widthStd, uiNodeChild1.widthStd, '宽度:父元素=子元素1');
assert.strictEqual(uiNodeChild1.widthStd, uiNodeChild3.widthStd, '宽度:子元素1=子元素3');
assert.isAbove(uiNodeChild1.topStd - uiNodeParent.topStd, 0, '父子顶部距离:>0');
assert.approxEqual(uiNodeChild1.topStd - uiNodeParent.topStd, uiNodeParent.bottomStd - uiNodeChild3.bottomStd, '父子距离:顶部~底部');
});
it('flex-direction:column,flex-wrap:nowrap,justify-content:space-between,align-items:stretch', async () => {
// ['column', 'nowrap', 'space-between', 'stretch']
vm.changeFlexStyle3(14);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex3')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex3').childNodes[0]));
const uiNodeChild2 = normalize(nodeRect(vm.$element('uiFlex3').childNodes[1]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex3').childNodes[2]));
assert.approxEqual(uiNodeChild1.heightStd, 100, '高度:子元素1~100');
assert.strictEqual(uiNodeParent.widthStd, uiNodeChild1.widthStd, '宽度:父元素=子元素1');
assert.strictEqual(uiNodeChild1.widthStd, uiNodeChild3.widthStd, '宽度:子元素1=子元素3');
assert.strictEqual(uiNodeParent.topStd, uiNodeChild1.topStd, '顶部位置:父元素=子元素1');
assert.strictEqual(uiNodeParent.bottomStd, uiNodeChild3.bottomStd, '底部位置:父元素=子元素3');
assert.isAbove(uiNodeChild2.topStd - uiNodeChild1.bottomStd, 0, '子元素上下边距:>0');
assert.approxEqual(uiNodeChild2.topStd - uiNodeChild1.bottomStd, uiNodeChild3.topStd - uiNodeChild2.bottomStd, '子元素上下边距:12~23');
});
it('flex-direction:column,flex-wrap:nowrap,justify-content:flex-start,align-items:flex-start', async () => {
// ['column', 'nowrap', 'flex-start', 'flex-start']
vm.changeFlexStyle2(15);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex2')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[0]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[2]));
assert.strictEqual(uiNodeParent.topStd, uiNodeChild1.topStd, '顶部位置:父元素=子元素1');
assert.strictEqual(uiNodeParent.leftStd, 0, '左边位置:父元素>0');
assert.strictEqual(uiNodeParent.leftStd, uiNodeChild1.leftStd, '左边位置:父元素=子元素1');
assert.strictEqual(uiNodeChild1.leftStd, uiNodeChild3.leftStd, '左边位置:子元素1=子元素3');
assert.approxEqual(uiNodeChild1.widthStd, 200, '宽度:子元素1~200');
assert.approxEqual(uiNodeParent.heightStd / 3, uiNodeChild1.heightStd, '高度:父元素/3~子元素1');
});
it('flex-direction:column,flex-wrap:nowrap,justify-content:flex-start,align-items:flex-end', async () => {
// ['column', 'nowrap', 'flex-start', 'flex-end']
vm.changeFlexStyle2(16);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex2')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[0]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[2]));
assert.strictEqual(uiNodeParent.topStd, uiNodeChild1.topStd, '顶部位置:父元素=子元素1');
assert.strictEqual(uiNodeParent.right, 750, '右边位置:父元素=750');
assert.strictEqual(uiNodeParent.rightStd, uiNodeChild1.rightStd, '右边位置:父元素=子元素1');
assert.strictEqual(uiNodeChild1.rightStd, uiNodeChild3.rightStd, '右边位置:子元素1=子元素3');
assert.approxEqual(uiNodeChild1.widthStd, 200, '宽度:子元素1~200');
assert.approxEqual(uiNodeParent.heightStd / 3, uiNodeChild1.heightStd, '高度:父元素/3~子元素1');
});
it('flex-direction:column,flex-wrap:nowrap,justify-content:flex-start,align-items:center', async () => {
// ['column', 'nowrap', 'flex-start', 'center']
vm.changeFlexStyle2(17);
await waitForOK(50);
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex2')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[0]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex2').childNodes[2]));
assert.strictEqual(uiNodeParent.topStd, uiNodeChild1.topStd, '顶部位置:父元素=子元素1');
assert.isAbove(uiNodeChild1.leftStd - uiNodeParent.leftStd, 0, '父子左边距:>0');
assert.approxEqual(uiNodeChild1.leftStd - uiNodeParent.leftStd, uiNodeParent.rightStd - uiNodeChild1.rightStd, '父子边距:左边=右边');
assert.strictEqual(uiNodeChild1.leftStd, uiNodeChild3.leftStd, '左边位置:子元素1=子元素3');
assert.approxEqual(uiNodeChild1.widthStd, 200, '宽度:子元素1~200');
assert.approxEqual(uiNodeParent.heightStd / 3, uiNodeChild1.heightStd, '高度:父元素/3~子元素1');
});
it('flex-direction:row-reverse,其他属性为默认值', function () {
const uiNodeParent = normalize(nodeRect(vm.$element('uiFlex4')));
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex4').childNodes[0]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex4').childNodes[2]));
assert.strictEqual(uiNodeParent.topStd, uiNodeChild1.topStd, '顶部位置:父元素=子元素1');
assert.strictEqual(uiNodeChild1.topStd, uiNodeChild3.topStd, '顶部位置:子元素1=子元素3');
assert.strictEqual(uiNodeParent.rightStd, uiNodeChild1.rightStd, '右边位置:父元素=子元素1');
assert.strictEqual(uiNodeParent.heightStd, uiNodeChild1.heightStd, '高度:父元素=子元素1');
});
it('flex-direction:column-reverse,其他属性为默认值', function () {
const uiNodeChild1 = normalize(nodeRect(vm.$element('uiFlex5').childNodes[0]));
const uiNodeChild3 = normalize(nodeRect(vm.$element('uiFlex5').childNodes[2]));
assert.isAbove(uiNodeChild1.bottomStd, uiNodeChild3.bottomStd);
});
});
}
/***/ })
/******/ });
/************************************************************************/
/******/ // 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/div/flex/index.ux?uxType=page");
/******/
/******/ })()
;
};
return createPageHandler();
};