How to use initTypeOptions method in Testcafe

Best JavaScript code snippet using testcafe

cam-dtal-lion.js

Source:cam-dtal-lion.js Github

copy

Full Screen

...1109 initEdgeMetricOptions();1110 // Initialize aggregation metric options menu1111 initAggregationFuncOptions();1112 // Initialize object types menu1113 initTypeOptions();1114}1115function initEdgeMetricOptions()1116{1117 // --------------------------------------- 1118 // Initialize edge metric options1119 // --------------------------------------- 1120 var edge_metric_options_html = '';1121 for(var i = 0; i < edge_metric_values_index.length; i++)1122 {1123 edge_metric_options_html += '<div class="item cam-dtal-lion-edge-metric" data-value="edge-sort" data-subvalue="' + edge_metric_values_index[i] + '"><i class="ui green checkmark icon cam-dtal-lion-edge-metric-tick cam-dtal-lion-edge-metric-tick-' + edge_metric_values_index[i] + '"></i>' + edge_metric_values_data[i].short+ '</div>';1124 // Remove popupup to avoid problem of menu disappearing - 08/06/2017 1125 /*1126 edge_metric_options_html += '<div class="item cam-dtal-lion-edge-metric" data-content="' + edge_metric_values_data[i].long + '" data-position="left center" data-value="edge-sort" data-subvalue="' + edge_metric_values_index[i] + '"><i class="ui green checkmark icon cam-dtal-lion-edge-metric-tick cam-dtal-lion-edge-metric-tick-' + edge_metric_values_index[i] + '"></i>' + edge_metric_values_data[i].short+ '</div>';1127 */1128 }1129 $('.cam-dtal-lion-edge-metric-options').append(edge_metric_options_html);1130 $('.cam-dtal-lion-edge-metric').popup();1131 if (edge_metric_values_index.indexOf(edge_metric) != -1) setEdgeMetric(edge_metric);1132}1133function initAggregationFuncOptions()1134{1135 // --------------------------------------- 1136 // Initialize aggregation metric options1137 // --------------------------------------- 1138 var aggregation_func_options_html = '';1139 for(var i = 0; i < aggregation_func_values_index.length; i++)1140 {1141 aggregation_func_options_html += '<div class="item cam-dtal-lion-aggregation-func" data-value="aggregation-sort" data-subvalue="' + aggregation_func_values_index[i] + '"><i class="ui green checkmark icon cam-dtal-lion-aggregation-func-tick cam-dtal-lion-aggregation-func-tick-' + aggregation_func_values_index[i] + '"></i>' + aggregation_func_values_data[i].short+ '</div>';1142 }1143 $('.cam-dtal-lion-aggregation-func-options').append(aggregation_func_options_html);1144 $('.cam-dtal-lion-aggregation-func').popup();1145 if (aggregation_func_values_index.indexOf(aggregation_func) != -1) setAggregationFunc(aggregation_func);1146}1147function initTypeOptions()1148{1149 // --------------------------------------- 1150 // Initialize object type options1151 // --------------------------------------- 1152 var types_html = '';1153 var expand_types_html = '';1154 for(var i = 0; i < alltypes_code.length; i++)1155 {1156 types_html += '<div class="item ' + alltypes_code[i] + '" data-value="' + alltypes_code[i] + '">' + alltypes_description[i] + '</div>';1157 expand_types_html += '<div class="item nodeexpandtype ' + alltypes_code[i] + '" data-value="' + alltypes_code[i] + '">' + alltypes_description[i] + '</div>';1158 }1159 $('.cam-dtal-lion-type-options').append(types_html);1160 $('.cam-dtal-lion-dialog-node-expandbytype-content').append(expand_types_html);1161 revertTypesToInternalValues(); ...

Full Screen

Full Screen

index.jsx

Source:index.jsx Github

copy

Full Screen

...289 }290 //更新状态291 setPlaceOptions([...placeOptions]);292 };293 initTypeOptions();294 initPlaceOptions();295 }, [asset, isUpdate]);296 return (297 <Card title={title}>298 <Form299 labelCol={{300 xs: { span: 24, offset: 0 },301 sm: { span: 4, offset: 4 },302 }}303 wrapperCol={{304 xs: { span: 24 },305 sm: { span: 12 },306 }}307 onFinish={onFinish}308 >309 <Item310 name="types"311 initialValue={types}312 label="资产类型"313 rules={[{ required: true }]}314 >315 <Cascader316 placeholder="请选择资产类型"317 disabled={isUpdate}318 options={typeOptions}319 loadData={loadTypeData}320 onChange={onTypeChange}321 />322 </Item>323 <Item324 name="name"325 initialValue={asset.name}326 label="资产名称"327 rules={[{ required: true }]}328 >329 <Input placeholder="请输入资产名称" />330 </Item>331 <Item332 name="statusDisplay"333 label="状态"334 initialValue={335 asset.status ? (asset.status === 1 ? true : false) : true336 }337 valuePropName="checked"338 rules={[{ required: true }]}339 >340 <Switch checkedChildren="使用中" unCheckedChildren="停止使用" />341 </Item>342 <Item name="places" initialValue={places} label="资产位置">343 <Cascader344 placeholder="请选择资产位置"345 options={placeOptions}346 loadData={loadPlaceData}347 />348 </Item>349 <Item name="use_dept" initialValue={asset.use_dept} label="使用部门">350 <Input placeholder="请输入使用部门" />351 </Item>352 <Item353 name="manage_user"354 initialValue={asset.manage_user}355 label="管理人"356 >357 <Input placeholder="请输入管理人" />358 </Item>359 <Item name="model" initialValue={asset.model} label="型号">360 <Input placeholder="请输入型号" />361 </Item>362 <Item363 name="manufactory"364 initialValue={asset.manufactory}365 label="生产厂家"366 >367 <Input placeholder="请输入生产厂家" />368 </Item>369 <Item name="sn" initialValue={asset.sn} label="系列号">370 <Input placeholder="请输入系列号" />371 </Item>372 <Item373 name="product_dateObj"374 initialValue={asset.product_date ? moment(asset.product_date) : null}375 label="生产日期"376 >377 <DatePicker placeholder="请选择生产日期" />378 </Item>379 <Item380 name="trade_dateObj"381 initialValue={asset.trade_date ? moment(asset.trade_date) : null}382 label="购买日期"383 >384 <DatePicker placeholder="请选择购买日期" />385 </Item>386 <Item387 name="expire_dateObj"388 initialValue={asset.expire_date ? moment(asset.expire_date) : null}389 label="过保日期"390 >391 <DatePicker placeholder="请选择过保日期" />392 </Item>393 <Item394 name="asset_code"395 initialValue={asset.asset_code}396 label="固定资产编码"397 >398 <Input placeholder="请输入固定资产编码" />399 </Item>400 {(() => {401 switch (type) {402 case "PC":403 return <PCAddUpdate asset={asset} />;404 case "Printer":405 return <PrinterAddUpdate asset={asset} />;406 case "Server":407 return <ServerAddUpdate asset={asset} />;408 case "NetDevice":409 return <NetDevAddUpdate asset={asset} />;410 case "SecDevice":411 return <SecDevAddUpdate asset={asset} />;412 default:413 return null;414 }415 })()}416 <Item417 wrapperCol={{418 xs: { span: 24, offset: 0 },419 sm: { span: 16, offset: 8 },420 }}421 >422 <Button type="primary" htmlType="submit">423 提交424 </Button>425 </Item>426 </Form>427 </Card>428 );429}430// class AssetAddUpdate extends Component {431// state = {432// typeOptions: [],//资产类型级联下拉框的Options433// placeOptions: [],//资产位置级联下拉框的Options434// type: '',//记录资产类型选中的分类,动态加载对应组件435// }436// initTypeOptions = async () => {437// const typeOptions = []438// for (var key in ASSET_TYPES) {439// const option = { value: key, label: ASSET_TYPES[key], isLeaf: false }440// typeOptions.push(option)441// }442// //如果是编辑资产且存在资产子类443// const { isUpdate, asset } = this444// const { type, sub_type } = asset445// if (isUpdate && sub_type) {446// //获取资产子类447// const result = await reqCategorys(type)448// if (result.code === "success") {449// //生成子类列表450// const categorys = result.data451// const childOptions = categorys.map(c => ({452// value: c.id,453// label: c.name,454// isLeaf: true455// }))456// //找到对应的一级分类Option并关联457// const targetOption = typeOptions.find(option => option.value === type)458// targetOption.children = childOptions459// } else {460// message.error('获取分类列表失败')461// }462// }463// this.setState({464// typeOptions465// })466// }467// loadTypeData = async selectedOptions => {468// const targetOption = selectedOptions[0];469// targetOption.loading = true;470// const result = await reqCategorys(targetOption.value)471// targetOption.loading = false;472// this.setState({ loading: false })473// if (result.code === "success") {474// const categorys = result.data475// if (categorys && categorys.length > 0) {476// const childOptions = categorys.map(c => ({477// value: c.id,478// label: c.name,479// isLeaf: true480// }))481// targetOption.children = childOptions482// }483// else {484// targetOption.isLeaf = true485// }486// this.setState({487// typeOptions: [...this.state.typeOptions]488// })489// } else {490// message.error('获取分类列表失败')491// }492// }493// onTypeChange = (value, selectedOptions) => {494// console.log(value, selectedOptions)495// if (value[0] !== this.state.type) {496// this.setState({497// type: value[0]498// })499// }500// }501// //获取位置列表502// getPlaces = async (parent_Id) => {503// const result = await reqPlaces(parent_Id)504// if (result.code === "success") {505// return result.data506// } else {507// message.error('获取分类列表失败')508// }509// }510// //初始化位置级联下拉框的Options511// initPlaceOptions = async () => {512// //初始化最顶端父节点513// const placeOptions = [{ value: 0, label: 'XX公司', isLeaf: false }]514// //如果是编辑资产515// const { isUpdate, asset } = this516// if (isUpdate && asset.place_obj && asset.place_obj.parent_ids && asset.place_obj.parent_ids.length > 1) {517// const place_id = asset.place_obj.parent_ids518// //遍历parent,读取当前的所有父位置的列表,并形成options519// let parentOptions = placeOptions520// for (let id of place_id) {521// const places = await this.getPlaces(id)522// const childOptions = places.map(p => ({523// value: p.id,524// label: p.name,525// isLeaf: !p.hasChildren526// }))527// //找到对应的父分类Option并关联528// const targetOption = parentOptions.find(option => option.value === id)529// targetOption.children = childOptions530// parentOptions = childOptions531// }532// }533// //更新状态534// this.setState({ placeOptions })535// }536// //用户点击级联下拉框相应选项,动态加载下一级537// loadPlaceData = async selectedOptions => {538// const targetOption = selectedOptions[selectedOptions.length - 1];539// targetOption.loading = true;540// const result = await reqPlaces(targetOption.value)541// targetOption.loading = false;542// this.setState({ loading: false })543// if (result.code === "success") {544// const places = result.data545// if (places && places.length > 0) {546// const childOptions = places.map(c => ({547// value: c.id,548// label: c.name,549// isLeaf: !c.hasChildren550// }))551// targetOption.children = childOptions552// }553// else {554// targetOption.isLeaf = true555// }556// this.setState({557// placeOptions: [...this.state.placeOptions]558// })559// } else {560// message.error('获取分类列表失败')561// }562// }563// //表单提交处理564// onFinish = async (values) => {565// //获取并处理数据566// const {567// name,568// types,569// statusDisplay,570// places,571// use_dept,572// manage_user,573// model,574// manufactory,575// sn,576// product_dateObj,577// trade_dateObj,578// expire_dateObj,579// asset_code,580// ip,581// mac,582// display,583// printer,584// cpu,585// memory,586// disk,587// os,588// func_type,589// paper,590// nic,591// database,592// middleware,593// usage,594// online_dateObj,595// management_ip,596// port_num,597// device_detail,598// } = values599// //status处理600// let status = 2601// if (statusDisplay) {602// status = 1603// }604// //type.sub_type处理605// let type, sub_type606// if (types.length === 1) {607// type = types[0]608// }609// else {610// type = types[0]611// sub_type = types[1]612// }613// //位置处理614// let place615// if (places.length > 0) {616// place = places[places.length - 1]617// }618// else {619// place = null620// }621// if (use_dept === '') {622// use_dept = null623// }624// if (manage_user === '') {625// manage_user = null626// }627// //日期处理628// const product_date = product_dateObj ? product_dateObj.format('YYYY-MM-DD') : null629// const trade_date = trade_dateObj ? trade_dateObj.format('YYYY-MM-DD') : null630// const expire_date = expire_dateObj ? expire_dateObj.format('YYYY-MM-DD') : null631// const online_date = online_dateObj ? online_dateObj.format('YYYY-MM-DD') : null632// const asset = {633// name,634// type,635// sub_type,636// status,637// place,638// use_dept,639// manage_user,640// model,641// manufactory,642// sn,643// product_date,644// trade_date,645// expire_date,646// asset_code,647// ip,648// mac,649// display,650// printer,651// cpu,652// memory,653// disk,654// os,655// func_type,656// paper,657// nic,658// database,659// middleware,660// usage,661// online_date,662// management_ip,663// port_num,664// device_detail,665// }666// //如果是更新,还需要加入id667// if (this.isUpdate) {668// asset.id = this.asset.id669// }670// //发送请求671// const result = await reqAddOrUpdateAsset(asset)672// if (result.code === "success") {673// message.success(`${this.isUpdate ? '更新' : '新增'}资产成功`)674// this.props.history.goBack()675// }676// else {677// message.error(`${this.isUpdate ? '更新' : '新增'}资产失败`)678// }679// };680// constructor(props) {681// super(props)682// const asset = this.props.location.state683// this.isUpdate = !!asset684// this.asset = asset || {}685// }686// componentDidMount() {687// if (this.isUpdate) {688// this.setState({689// type: this.props.location.state.type690// })691// }692// this.initTypeOptions()693// this.initPlaceOptions()694// }695// render() {696// const { typeOptions, type, placeOptions } = this.state697// const { isUpdate, asset } = this698// const types = []699// if (isUpdate) {700// types.push(asset.type)701// if (asset.sub_type) {702// types.push(asset.sub_type)703// }704// }705// let places = []706// if (isUpdate) {...

Full Screen

Full Screen

actions.js

Source:actions.js Github

copy

Full Screen

1import TYPE from './type';2import SelectorBuilder from '../../client-functions/selectors/selector-builder';3import ClientFunctionBuilder from '../../client-functions/client-function-builder';4import functionBuilderSymbol from '../../client-functions/builder-symbol';5import Assignable from '../../utils/assignable';6import { ActionOptions, ClickOptions, MouseOptions, TypeOptions } from './options';7import {8 actionOptions,9 integerArgument,10 positiveIntegerArgument,11 nonEmptyStringArgument,12 urlArgument,13 stringOrStringArrayArgument,14 setSpeedArgument15} from './validations/argument';16import { ActionSelectorError, SetNativeDialogHandlerCodeWrongTypeError } from '../../errors/test-run';17import { APIError } from '../../errors/runtime';18// Initializers19function initSelector (name, val, skipVisibilityCheck) {20 try {21 var builder = new SelectorBuilder(val, { visibilityCheck: !skipVisibilityCheck }, { instantiation: 'Selector' });22 return builder.getCommand([]);23 }24 catch (err) {25 var msg = err.constructor === APIError ? err.rawMessage : err.message;26 throw new ActionSelectorError(name, msg);27 }28}29function initActionOptions (name, val) {30 return new ActionOptions(val, true);31}32function initClickOptions (name, val) {33 return new ClickOptions(val, true);34}35function initMouseOptions (name, val) {36 return new MouseOptions(val, true);37}38function initTypeOptions (name, val) {39 return new TypeOptions(val, true);40}41function initDialogHandler (name, val) {42 var fn = val.dialogHandler;43 var options = val.options;44 var methodName = 'setNativeDialogHandler';45 var builder = fn && fn[functionBuilderSymbol];46 builder = builder instanceof ClientFunctionBuilder ? builder : null;47 if (builder) {48 if (builder instanceof SelectorBuilder)49 throw new SetNativeDialogHandlerCodeWrongTypeError(builder.callsiteNames.instantiation);50 fn = fn.with(options);51 builder = fn[functionBuilderSymbol];52 }53 else {54 var functionType = typeof fn;55 if (functionType !== 'function')56 throw new SetNativeDialogHandlerCodeWrongTypeError(functionType);57 builder = new ClientFunctionBuilder(fn, options, {58 instantiation: methodName,59 execution: methodName60 });61 }62 return builder.getCommand([]);63}64// Commands65export class ClickCommand extends Assignable {66 constructor (obj) {67 super(obj);68 this.type = TYPE.click;69 this.selector = null;70 this.options = null;71 this._assignFrom(obj, true);72 }73 _getAssignableProperties () {74 return [75 { name: 'selector', init: initSelector, required: true },76 { name: 'options', type: actionOptions, init: initClickOptions, required: true }77 ];78 }79}80export class RightClickCommand extends Assignable {81 constructor (obj) {82 super(obj);83 this.type = TYPE.rightClick;84 this.selector = null;85 this.options = null;86 this._assignFrom(obj, true);87 }88 _getAssignableProperties () {89 return [90 { name: 'selector', init: initSelector, required: true },91 { name: 'options', type: actionOptions, init: initClickOptions, required: true }92 ];93 }94}95export class DoubleClickCommand extends Assignable {96 constructor (obj) {97 super(obj);98 this.type = TYPE.doubleClick;99 this.selector = null;100 this.options = null;101 this._assignFrom(obj, true);102 }103 _getAssignableProperties () {104 return [105 { name: 'selector', init: initSelector, required: true },106 { name: 'options', type: actionOptions, init: initClickOptions, required: true }107 ];108 }109}110export class HoverCommand extends Assignable {111 constructor (obj) {112 super(obj);113 this.type = TYPE.hover;114 this.selector = null;115 this.options = null;116 this._assignFrom(obj, true);117 }118 _getAssignableProperties () {119 return [120 { name: 'selector', init: initSelector, required: true },121 { name: 'options', type: actionOptions, init: initMouseOptions, required: true }122 ];123 }124}125export class TypeTextCommand extends Assignable {126 constructor (obj) {127 super(obj);128 this.type = TYPE.typeText;129 this.selector = null;130 this.text = null;131 this.options = null;132 this._assignFrom(obj, true);133 }134 _getAssignableProperties () {135 return [136 { name: 'selector', init: initSelector, required: true },137 { name: 'text', type: nonEmptyStringArgument, required: true },138 { name: 'options', type: actionOptions, init: initTypeOptions, required: true }139 ];140 }141}142export class DragCommand extends Assignable {143 constructor (obj) {144 super(obj);145 this.type = TYPE.drag;146 this.selector = null;147 this.dragOffsetX = null;148 this.dragOffsetY = null;149 this.options = null;150 this._assignFrom(obj, true);151 }152 _getAssignableProperties () {153 return [154 { name: 'selector', init: initSelector, required: true },155 { name: 'dragOffsetX', type: integerArgument, required: true },156 { name: 'dragOffsetY', type: integerArgument, required: true },157 { name: 'options', type: actionOptions, init: initMouseOptions, required: true }158 ];159 }160}161export class DragToElementCommand extends Assignable {162 constructor (obj) {163 super(obj);164 this.type = TYPE.dragToElement;165 this.selector = null;166 this.destinationSelector = null;167 this.options = null;168 this._assignFrom(obj, true);169 }170 _getAssignableProperties () {171 return [172 { name: 'selector', init: initSelector, required: true },173 { name: 'destinationSelector', init: initSelector, required: true },174 { name: 'options', type: actionOptions, init: initMouseOptions, required: true }175 ];176 }177}178export class SelectTextCommand extends Assignable {179 constructor (obj) {180 super(obj);181 this.type = TYPE.selectText;182 this.selector = null;183 this.startPos = null;184 this.endPos = null;185 this.options = null;186 this._assignFrom(obj, true);187 }188 _getAssignableProperties () {189 return [190 { name: 'selector', init: initSelector, required: true },191 { name: 'startPos', type: positiveIntegerArgument },192 { name: 'endPos', type: positiveIntegerArgument },193 { name: 'options', type: actionOptions, init: initActionOptions, required: true }194 ];195 }196}197export class SelectEditableContentCommand extends Assignable {198 constructor (obj) {199 super(obj);200 this.type = TYPE.selectEditableContent;201 this.startSelector = null;202 this.endSelector = null;203 this.options = null;204 this._assignFrom(obj, true);205 }206 _getAssignableProperties () {207 return [208 { name: 'startSelector', init: initSelector, required: true },209 { name: 'endSelector', init: initSelector },210 { name: 'options', type: actionOptions, init: initActionOptions, required: true }211 ];212 }213}214export class SelectTextAreaContentCommand extends Assignable {215 constructor (obj) {216 super(obj);217 this.type = TYPE.selectTextAreaContent;218 this.selector = null;219 this.startLine = null;220 this.startPos = null;221 this.endLine = null;222 this.endPos = null;223 this.options = null;224 this._assignFrom(obj, true);225 }226 _getAssignableProperties () {227 return [228 { name: 'selector', init: initSelector, required: true },229 { name: 'startLine', type: positiveIntegerArgument },230 { name: 'startPos', type: positiveIntegerArgument },231 { name: 'endLine', type: positiveIntegerArgument },232 { name: 'endPos', type: positiveIntegerArgument },233 { name: 'options', type: actionOptions, init: initActionOptions, required: true }234 ];235 }236}237export class PressKeyCommand extends Assignable {238 constructor (obj) {239 super(obj);240 this.type = TYPE.pressKey;241 this.keys = '';242 this.options = null;243 this._assignFrom(obj, true);244 }245 _getAssignableProperties () {246 return [247 { name: 'keys', type: nonEmptyStringArgument, required: true },248 { name: 'options', type: actionOptions, init: initActionOptions, required: true }249 ];250 }251}252export class NavigateToCommand extends Assignable {253 constructor (obj) {254 super(obj);255 this.type = TYPE.navigateTo;256 this.url = null;257 this._assignFrom(obj, true);258 }259 _getAssignableProperties () {260 return [261 { name: 'url', type: urlArgument, required: true }262 ];263 }264}265export class SetFilesToUploadCommand extends Assignable {266 constructor (obj) {267 super(obj);268 this.type = TYPE.setFilesToUpload;269 this.selector = null;270 this.filePath = '';271 this._assignFrom(obj, true);272 }273 _getAssignableProperties () {274 return [275 { name: 'selector', init: (name, val) => initSelector(name, val, true), required: true },276 { name: 'filePath', type: stringOrStringArrayArgument, required: true }277 ];278 }279}280export class ClearUploadCommand extends Assignable {281 constructor (obj) {282 super(obj);283 this.type = TYPE.clearUpload;284 this.selector = null;285 this._assignFrom(obj, true);286 }287 _getAssignableProperties () {288 return [289 { name: 'selector', init: (name, val) => initSelector(name, val, true), required: true }290 ];291 }292}293export class SwitchToIframeCommand extends Assignable {294 constructor (obj) {295 super(obj);296 this.type = TYPE.switchToIframe;297 this.selector = null;298 this._assignFrom(obj, true);299 }300 _getAssignableProperties () {301 return [302 { name: 'selector', init: initSelector, required: true }303 ];304 }305}306export class SwitchToMainWindowCommand {307 constructor () {308 this.type = TYPE.switchToMainWindow;309 }310}311export class SetNativeDialogHandlerCommand extends Assignable {312 constructor (obj) {313 super(obj);314 this.type = TYPE.setNativeDialogHandler;315 this.dialogHandler = {};316 this._assignFrom(obj, true);317 }318 _getAssignableProperties () {319 return [320 { name: 'dialogHandler', init: initDialogHandler, required: true }321 ];322 }323}324export class GetNativeDialogHistoryCommand {325 constructor () {326 this.type = TYPE.getNativeDialogHistory;327 }328}329export class SetTestSpeedCommand extends Assignable {330 constructor (obj) {331 super(obj);332 this.type = TYPE.setTestSpeed;333 this.speed = null;334 this._assignFrom(obj, true);335 }336 _getAssignableProperties () {337 return [338 { name: 'speed', type: setSpeedArgument, required: true }339 ];340 }...

Full Screen

Full Screen

errorCheckCtl.js

Source:errorCheckCtl.js Github

copy

Full Screen

1angular.module('app').controller('ErrorCheckCtl', ['$window', '$scope', '$timeout', 'dsEdit', 'appPath', function ($window, $scope, $timeout, dsEdit, appPath) {2 var selectCtrl = fastmap.uikit.SelectController();3 $scope.initType = 0;4 /**5 * table表头配置项6 * @type {string[]}7 */8 $scope.theadInfo = ['检查规则', '错误等级', '错误对象', '错误信息', '检查时间', '检查管理'];9 $scope.initTypeOptions = [10 {11 id: 0,12 label: ' 未修改'13 },14 {15 id: 1,16 label: ' 例外'17 },18 {19 id: 2,20 label: ' 确认不修改'21 },22 {23 id: 3,24 label: ' 确认已修改'25 }26 ];27 /**28 * 修改table单元格显示的宽度防止属性面板弹出挤压出现垂直滚动条;29 */30 $scope.setTableCeilWidth = function () {31 var tableWidth = document.getElementById('errorCheckTable').clientWidth;32 $scope.descriptStyle = {33 width: (tableWidth - 60 - tableWidth * 0.06 - tableWidth * 0.05 - 110 - 110) + 'px',34 overflow: 'hidden',35 'text-overflow': 'ellipsis',36 'white-space': 'nowrap'37 };38 };39 /**40 * 修改检查项状态41 * @param selectInd42 * @param rowid43 */44 $scope.changeType = function (selectInd, rowid) {45 dsEdit.updateCheckType(rowid, selectInd).then(function (data) {46 console.log('修改成功');47 if ($scope.checkResultData.length > 1) {48 for (var i = 0; i < $scope.checkResultData.length; i++) {49 if ($scope.checkResultData[i].id == rowid) {50 $scope.checkResultData.splice(i, 1);51 break;52 }53 }54 } else {55 $scope.$emit('refreshCheckResult', true);56 }57 });58 };59 // 重新设置选择工具60 var resetToolAndMap = function () {61 var layerCtrl = fastmap.uikit.LayerController();62 var editLayer = layerCtrl.getLayerById('edit');63 var rdLink = layerCtrl.getLayerById('rdLink');64 var shapeCtrl = fastmap.uikit.ShapeEditorController();65 var tooltipsCtrl = fastmap.uikit.ToolTipsController();66 var eventCtrl = fastmap.uikit.EventController();67 eventCtrl.off(eventCtrl.eventTypes.GETLINKID); // 清除select**ShapeCtrl.js中的事件,防止菜单之间事件错乱68 eventCtrl.off(eventCtrl.eventTypes.GETADADMINNODEID);69 eventCtrl.off(eventCtrl.eventTypes.GETNODEID);70 eventCtrl.off(eventCtrl.eventTypes.GETRELATIONID);71 eventCtrl.off(eventCtrl.eventTypes.GETTIPSID);72 eventCtrl.off(eventCtrl.eventTypes.GETFACEID);73 eventCtrl.off(eventCtrl.eventTypes.RESETCOMPLETE);74 eventCtrl.off(eventCtrl.eventTypes.GETBOXDATA);75 eventCtrl.off(eventCtrl.eventTypes.GETRECTDATA);76 eventCtrl.off(eventCtrl.eventTypes.GETFEATURE);77 if (map.floatMenu) {78 map.removeLayer(map.floatMenu);79 map.floatMenu = null;80 }81 map.scrollWheelZoom.enable();82 editLayer.drawGeometry = null;83 editLayer.clear();84 editLayer.bringToBack();85 shapeCtrl.shapeEditorResult.setFinalGeometry(null);86 shapeCtrl.shapeEditorResult.setOriginalGeometry(null);87 shapeCtrl.stopEditing();88 rdLink.clearAllEventListeners();89 if (tooltipsCtrl.getCurrentTooltip()) {90 tooltipsCtrl.onRemoveTooltip();91 }92 if (map.currentTool) {93 map.currentTool.disable(); // 禁止当前的参考线图层的事件捕获94 }95 if (selectCtrl.rowKey) {96 selectCtrl.rowKey = null;97 }98 $(editLayer.options._div).unbind();99 };100 /**101 * 定位并高亮显示要素102 * @param pid103 * @param type104 */105 $scope.showOnMap = function (pid, featType, checkResult) {106 resetToolAndMap();107 if (checkResult.geometry) {108 var coord = checkResult.geometry.replace(/\(|\)/g, '').split(',');109 var zoom = map.getZoom() < 17 ? 17 : map.getZoom();110 map.setView([parseFloat(coord[1]), parseFloat(coord[0])], zoom);111 }112 $scope.$emit('locatedOnMap', {113 objPid: pid,114 objType: featType.split('_').join('')115 });116 };117 // $scope.$on('highMappoi',highlighPoi);118 /** ************ 数据格式化 **************/119 /* 检查时间*/120 function getCreateData(a, rows) {121 return rows;122 }123 function getOption(b, rows) {124 return rows;125 }...

Full Screen

Full Screen

checkResultSubModalCtl.js

Source:checkResultSubModalCtl.js Github

copy

Full Screen

1angular.module('app').controller('checkResultSubModalCtl', ['$window', '$scope', '$timeout', 'dsEdit', 'dsMeta', 'appPath', function ($window, $scope, $timeout, dsEdit, dsMeta, appPath) {2 var selectCtrl = fastmap.uikit.SelectController();3 var highRenderCtrl = new fastmap.uikit.HighRenderController();4 var objCtrl = fastmap.uikit.ObjectEditController();5 $scope.initType = 0;6 /**7 * table表头配置项8 * @type {string[]}9 */10 $scope.theadInfo = ['检查规则', '错误等级', '错误对象', '错误信息', '检查时间', '检查管理'];11 $scope.initTypeOptions = [12 {13 id: 0,14 label: ' 未修改'15 },16 {17 id: 1,18 label: ' 例外'19 },20 {21 id: 2,22 label: ' 确认不修改'23 },24 {25 id: 3,26 label: ' 确认已修改'27 }28 ];29 /**30 * 查找检查结果31 */32 function getCheckResultData(num) {33 dsEdit.getRoadNameCheckResult(num).then(function (data) {34 if (data == -1) {35 return;36 }37 $scope.checkResultData = [];38 for (var i = 0, len = data.result.length; i < len; i++) {39 $scope.checkResultData.push(new FM.dataApi.IxCheckResult(data.result[i]));40 $scope.checkResultTotal = data.totalCount;41 $scope.checkPageTotal = data.totalCount > 0 ? Math.ceil(data.totalCount / 5) : 1;42 }43 });44 // dsMeta.columnDataList(num).then(function (data) {45 // $scope.checkResultData = [];46 // for (var i = 0, len = data.rows.length; i < len; i++) {47 // $scope.checkResultData.push(new FM.dataApi.IxCheckResult(data.rows[i]));48 // $scope.checkResultTotal = data.total;49 // $scope.checkPageTotal = data.total > 0 ? Math.ceil(data.total / 5) : 1;50 // }51 // })52 }53 initCheckResultData();54 /* 初始化检查结果数据*/55 function initCheckResultData() {56 $scope.checkPageNow = 1; // 检查结果当前页57 getCheckResultData(1);58// $scope.outputResult = dsOutput.output; // 输出结果59 }60 /**61 * 修改table单元格显示的宽度防止属性面板弹出挤压出现垂直滚动条;62 */63 $scope.setTableCeilWidth = function () {64 var tableWidth = document.getElementById('checkResultTable').clientWidth;65 $scope.descriptStyle = {66 width: (tableWidth - 60 - tableWidth * 0.06 - tableWidth * 0.05 - 110 - 110) + 'px',67 overflow: 'hidden',68 'text-overflow': 'ellipsis',69 'white-space': 'nowrap'70 };71 };72 /**73 * 修改检查项状态74 * @param selectInd75 * @param rowid76 */77 $scope.changeType = function (selectInd, rowid) {78 dsEdit.updateRdNCheckType(rowid, selectInd).then(function (data) {79 if (data) {80 console.log('修改成功');81 if ($scope.checkResultData.length > 1) {82 for (var i = 0; i < $scope.checkResultData.length; i++) {83 if ($scope.checkResultData[i].id == rowid) {84 $scope.checkResultData.splice(i, 1);85 break;86 }87 }88 } else {89 $scope.$emit('refreshCheckResult', true);90 }91 }92 });93 };94 /**95 * 展示编辑界面96 * @param pid97 * @param type98 */99 $scope.showDetail = function (id) {100 dsMeta.queryRdNByNameID(id).then(function (data) {101 if (data) {102 $scope.$emit('openEditPanel', data);103 $scope.closeSubModal();104 } else {105 swal('提示', '未查询到数据', 'error');106 }107 });108 };109 /* 翻页事件 */110 $scope.turnPage = function (type) {111 if (type == 'prev') { // 上一页112 $scope.$emit('trunPaging', 'prev');113 } else { // 下一页114 $scope.$emit('trunPaging', 'next');115 }116 };117 /**118 * 刷新检查119 */120 $scope.refreshCheckResult = function () {121 initCheckResultData();122 };...

Full Screen

Full Screen

deepParkingCtl.js

Source:deepParkingCtl.js Github

copy

Full Screen

1/**2 * Created by mali on 2016/5/31.3 */4angular.module('app').controller('deepParkingCtl', function ($scope) {5 var objectCtrl = fastmap.uikit.ObjectEditController();6 $scope.parkingBuildingType = FM.dataApi.Constant.PARKING_TYPE;7 $scope.tollStd = FM.dataApi.Constant.TOLLSTD;8 $scope.tollWay = FM.dataApi.Constant.TOLLWAY;9 $scope.remark = FM.dataApi.Constant.REMARK;10 /* 支付方式*/11 $scope.paymentObj = FM.dataApi.Constant.PAYMENT;12 var initDeepData = function () {13 $scope.poi = objectCtrl.data;14 if ($scope.poi.parkings.length === 0) { // 增加停车场默认为空的情况15 $scope.poi.parkings[0] = new FM.dataApi.IxPoiParking({ pid: objectCtrl.data.pid, parkingType: '' }); // parkingType要有默认值,因为常规POI深度信息保存时会有不为空的判断16 }17 };18 initDeepData();19 $scope.$on('reloadDeepData', function () {20 initDeepData();21 });22 $scope.tollStdChange = function (event) {23 var obj = $scope.poi.parkings[0].tollStd;24 var rejectVal = '5';25 if (event.target.value == rejectVal) {26 if (event.target.checked) {27 for (var key in obj) {28 if (key != rejectVal) {29 obj[key] = false;30 }31 }32 }33 } else if (event.target.checked) {34 obj[rejectVal] = false;35 }36 // Utils.setCheckboxMutex(event, obj, rejectVal);37 };38 $scope.remarkChange = function (event) {39 var exclude = ['7', '11', '12', '14', '16', '17', '18']; // 和'无条件免费'不互斥的值域40 var obj = $scope.poi.parkings[0].remark;41 var rejectVal = '0';42 if (event.target.value == rejectVal) {43 if (event.target.checked) {44 for (var key in obj) {45 if (key != rejectVal && exclude.indexOf(key) < 0) {46 obj[key] = false;47 }48 }49 }50 } else if (event.target.checked && exclude.indexOf(event.target.value) < 0) {51 obj[rejectVal] = false;52 }53// Utils.setCheckboxMutex(event,obj,rejectVal);54 };55 /**56 * 部分属性转全角57 */58 $scope.desToDBC = function () {59 if ($scope.poi.parkings[0].tollDes) {60 $scope.poi.parkings[0].tollDes = Utils.ToDBC($scope.poi.parkings[0].tollDes);61 }62 if ($scope.poi.parkings[0].openTiime) {63 $scope.poi.parkings[0].openTiime = Utils.ToDBC($scope.poi.parkings[0].openTiime);64 }65 };66 $scope.initTypeOptions = [67 { id: 0, label: ' 未修改' },68 { id: 1, label: ' 例外' },69 { id: 2, label: ' 确认不修改' },70 { id: 3, label: ' 确认已修改' }71 ];72 $scope.avgTotalNum = function () {73 var totalNum = $scope.poi.parkings[0].totalNum;74 if (!totalNum) {75 $scope.poi.parkings[0].totalNum = 0;76 }77 };...

Full Screen

Full Screen

parkingCtl.js

Source:parkingCtl.js Github

copy

Full Screen

1/**2 * Created by mali on 2016/5/31.3 */4angular.module('app').controller('parkingCtl', function ($scope) {5 $scope.parkingBuildingType = FM.dataApi.Constant.PARKING_TYPE;6 $scope.tollStd = FM.dataApi.Constant.TOLLSTD;7 $scope.tollWay = FM.dataApi.Constant.TOLLWAY;8 $scope.remark = FM.dataApi.Constant.remark_ml;9 /* 支付方式*/10 $scope.paymentObj = FM.dataApi.Constant.PAYMENT;11 $scope.tollStdChange = function (event) {12 var obj = $scope.poi.parkings[0].tollStd;13 var rejectVal = '5';14 Utils.setCheckboxMutex(event, obj, rejectVal);15 };16 $scope.remarkChange = function (event) {17 var obj = $scope.poi.parkings[0].remark;18 var rejectVal = '0';19 if (event.target.value == '0') {20 if (event.target.checked) {21 for (var key in obj) {22 if (key != '0' && key != '7') {23 obj[key] = false;24 }25 }26 }27 } else if (event.target.checked && event.target.value != '7') {28 obj['0'] = false;29 }30// Utils.setCheckboxMutex(event,obj,rejectVal);31 };32 $scope.test = function (event, obj, rejectVal1, rejectVal2) {33 for (var i = 0; i < rejectVal1.length; i++) {34 if (event.target.value == rejectVal1[i]) {35 if (event.target.checked) {36 for (var j = 0; j < rejectVal2.length; j++) {37 obj[rejectVal2[j]] = false;38 }39 }40 }41 }42 };43 $scope.initTypeOptions = [44 { id: 0, label: ' 未修改' },45 { id: 1, label: ' 例外' },46 { id: 2, label: ' 确认不修改' },47 { id: 3, label: ' 确认已修改' }48 ];...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#windows')5 .click('#submit-button');6});7test('My second test', async t => {8 .typeText('#developer-name', 'John Smith', { replace: true })9 .click('#windows')10 .click('#submit-button');11});12test('My third test', async t => {13 .typeText('#developer-name', 'John Smith', { replace: true })14 .click('#windows')15 .click('#submit-button');16});17test('My fourth test', async t => {18 .typeText('#developer-name', 'John Smith', { replace: true })19 .click('#windows')20 .click('#submit-button');21});22test('My fifth test', async t => {23 .typeText('#developer-name', 'John Smith', { replace: true })24 .click('#windows')25 .click('#submit-button');26});27test('My sixth test', async t => {28 .typeText('#developer-name', 'John Smith', { replace: true })29 .click('#windows')30 .click('#submit-button');31});32test('My seventh test', async t => {33 .typeText('#developer-name', 'John Smith', { replace: true })34 .click('#windows')35 .click('#submit-button');36});37test('My eighth test', async t => {38 .typeText('#developer-name', 'John Smith', { replace: true })39 .click('#windows')40 .click('#submit-button');41});42test('My ninth test', async t =>

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#windows')5 .click('#submit-button');6});7import { Selector } from 'testcafe';8test('My first test', async t => {9 .typeText('#developer-name', 'John Smith')10 .click('#windows')11 .click('#submit-button');12});13import { Selector } from 'testcafe';14test('My first test', async t => {15 .typeText('#developer-name', 'John Smith')16 .click('#windows')17 .click('#submit-button');18});19import { Selector } from 'testcafe';20test('My first test', async t => {21 .typeText('#developer-name', 'John Smith')22 .click('#windows')23 .click('#submit-button');24});25import { Selector } from 'testcafe';26test('My first test', async t => {27 .typeText('#developer-name', 'John Smith')28 .click('#windows')29 .click('#submit-button');30});31import { Selector } from 'testcafe';32test('My first test', async t => {33 .typeText('#developer-name', 'John Smith')34 .click('#windows')35 .click('#submit-button');36});

Full Screen

Using AI Code Generation

copy

Full Screen

1import {Selector} from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button');5 const articleHeader = await Selector('.result-content').find('h1');6 let headerText = await articleHeader.innerText;7 console.log(headerText);8});9import {Selector} from 'testcafe';10test('My first test', async t => {11 .typeText('#developer-name', 'John Smith')12 .click('#submit-button');13 const articleHeader = await Selector('.result-content').find('h1');14 let headerText = await articleHeader.innerText;15 console.log(headerText);16});17import {Selector} from 'testcafe';18test('My first test', async t => {19 .typeText('#developer-name', 'John Smith')20 .click('#submit-button');21 const articleHeader = await Selector('.result-content').find('h1');22 let headerText = await articleHeader.innerText;23 console.log(headerText);24});25import {Selector} from 'testcafe';26test('My first test', async t => {27 .typeText('#developer-name', 'John Smith')28 .click('#submit-button');29 const articleHeader = await Selector('.result-content').find('h1');

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My Test', async t => {3 const initTypeOptions = Selector('input').with({ boundTestRun: t });4 .typeText(initTypeOptions, 'Peter Parker')5 .typeText(initTypeOptions, 'Spiderman')6 .typeText(initTypeOptions, 'New York')7 .typeText(initTypeOptions, 'How i wish, i could fly.');8});9import { Selector } from 'testcafe';10test('My Test', async t => {11 const initTypeOptions = Selector('input').with({ boundTestRun: t });12 .typeText(initTypeOptions, 'Clark Kent')13 .typeText(initTypeOptions, 'Superman')14 .typeText(initTypeOptions, 'Metropolis')15 .typeText(initTypeOptions, 'Up, up and away!');16});17 √ My Test (1m 15s)18 √ My Test (1m 15s)19 2 passed (2m 31s)

Full Screen

Using AI Code Generation

copy

Full Screen

1import { initTypeOptions } from 'testcafe';2test('test', async t => {3 .typeText('#input', 'test', initTypeOptions)4 .typeText('#input', 'test', { replace: true })5 .typeText('#input', 'test', { caretPos: 1 })6 .typeText('#input', 'test', { replace: true, caretPos: 1 });7});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { initTypeOptions } from 'testcafe';2initTypeOptions({paste: true});3test('My Test', async t => {4 .typeText('#developer-name', 'Peter Parker')5 .typeText('#developer-name', 'Spiderman', {replace: true})6 .typeText('#developer-name', 'r', {caretPos: 2})7 .typeText('#developer-name', 'wo', {replace: true, caretPos: 5})8 .typeText('#developer-name', 'wo', {paste: true, replace: true, caretPos: 5})9 .typeText('#comments', 'This is a comment', {paste: true})10 .typeText('#comments', 'This is a comment', {replace: true})11 .typeText('#comments', 'This is a comment', {caretPos: 0})12 .typeText('#comments', 'This is a comment', {replace: true, caretPos: 0})13 .typeText('#comments', 'This is a comment', {paste: true, replace: true})14 .typeText('#comments', 'This is a comment', {paste: true, caretPos: 0})15 .typeText('#comments', 'This is a comment', {paste: true, replace: true, caretPos: 0})16 .typeText('#comments', 'This is a comment', {replace: true, caretPos: 10})17 .typeText('#comments', 'This is a comment', {paste: true, replace: true, caretPos: 10})18 .typeText('#comments', 'This is a comment', {paste: true, caretPos: 10})19 .typeText('#comments', 'This is a comment', {paste: true, replace: true, caretPos: 10});20});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My Test', async t => {3 const select = Selector('select').with({ boundTestRun: t });4 .click(select)5 .click(select.find('option').withText('I have tried TestCafe'));6});7import { Selector } from 'testcafe';8test('My Test', async t => {9 const select = Selector('select').with({ boundTestRun: t });10 .click(select)11 .click(select.find('option').withText('I have tried TestC

Full Screen

Using AI Code Generation

copy

Full Screen

1import { TestCafe } from 'testcafe';2const testcafe = new TestCafe();3testcafe.createRunner()4 .src('test.js')5 .browsers('chrome')6 .run({7 videoOptions: {8 pathPattern: '${DATE}_${TIME}/test-${TEST_INDEX}/${USERAGENT}/${FILE_INDEX}.mp4'9 },10 });

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Testcafe automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful