1/** 2 * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import router from '@system.router'; 17import {describe, beforeAll,afterAll, it, expect} from '@ohos/hypium'; 18 19 20export default function switchPropsJsTest() { describe('switchPropsJsTest', function () { 21 22 async function sleep(time) { 23 return new Promise((resolve, reject) => { 24 setTimeout(() => { 25 resolve() 26 }, time) 27 }).then(() => { 28 console.info(`sleep ${time} over...`) 29 }) 30 } 31 async function backToIndex() { 32 let backToIndexPromise = new Promise((resolve, reject) => { 33 setTimeout(() => { 34 router.back({ 35 uri: 'pages/index/index' 36 }); 37 resolve() 38 }, 500) 39 }) 40 let clearPromise = new Promise((resolve, reject) => { 41 setTimeout(() => { 42 router.clear() 43 resolve() 44 }, 500) 45 }) 46 await backToIndexPromise.then(() => { 47 return clearPromise 48 }) 49 } 50 51 /** 52 * run before testcase 53 */ 54 beforeAll(async function (done) { 55 console.info('[switchPropsJsTest] before each called') 56 57 let result; 58 let options = { 59 uri: 'pages/switch/prop/index' 60 } 61 try { 62 result = router.push(options) 63 console.info("push switchProps page success " + JSON.stringify(result)); 64 } catch (err) { 65 console.error("push switchProps page error " + JSON.stringify(result)); 66 } 67 await sleep(4000) 68 done() 69 }) 70 71 /** 72 * run after testcase 73 */ 74 afterAll(async function () { 75 console.info('[switchPropsJsTest] after each called') 76 await backToIndex() 77 await sleep(1000) 78 }) 79 80 /** 81 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 82 * @tc.name testSwitchIdProp 83 * @tc.desc ACE 84 */ 85 it('testSwitchIdProp', 0, async function (done) { 86 console.info('testSwitchIdProp START'); 87 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 88 89 let obj = JSON.parse(globalThis.value.idProp); 90 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 91 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 92 93 expect(obj.$type).assertEqual('switch') 94 expect(obj.$attrs.id).assertEqual('idProp') 95 done(); 96 }); 97 98 it('testSwitchClassProp', 0, async function (done) { 99 console.info('testSwitchClassProp START'); 100 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 101 102 let obj = JSON.parse(globalThis.value.classProp); 103 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 104 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 105 106 expect(obj.$type).assertEqual('switch') 107 expect(obj.$attrs.id).assertEqual('classProp') 108 expect(obj.$attrs.className).assertEqual('classProp') 109 done(); 110 }); 111 112 /** 113 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 114 * @tc.name testSwitchClassPropNone 115 * @tc.desc ACE 116 */ 117 it('testSwitchClassPropNone', 0, async function (done) { 118 console.info('testSwitchClassPropNone START'); 119 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 120 121 let obj = JSON.parse(globalThis.value.classPropNone); 122 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 123 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 124 125 expect(obj.$type).assertEqual('switch') 126 expect(obj.$attrs.id).assertEqual('classPropNone') 127 expect(obj.$attrs.className).assertEqual(undefined) 128 console.info("[switchProps] get className value is: " + JSON.stringify(obj.$attrs.className)); 129 done(); 130 }); 131 132 /** 133 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 134 * @tc.name testSwitchRefProp 135 * @tc.desc ACE 136 */ 137 it('testSwitchRefProp', 0, async function (done) { 138 console.info('testSwitchRefProp START'); 139 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 140 141 let obj = JSON.parse(globalThis.value.refProp); 142 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 143 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 144 145 expect(obj.$type).assertEqual('switch') 146 expect(obj.$attrs.id).assertEqual('refProp') 147 expect(obj.$attrs.ref).assertEqual('refProp') 148 done(); 149 }); 150 151 /** 152 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 153 * @tc.name testSwitchRefPropNone 154 * @tc.desc ACE 155 */ 156 it('testSwitchRefPropNone', 0, async function (done) { 157 console.info('testSwitchRefPropNone START'); 158 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 159 160 let obj = JSON.parse(globalThis.value.refPropNone); 161 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 162 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 163 164 expect(obj.$type).assertEqual('switch') 165 expect(obj.$attrs.id).assertEqual('refPropNone') 166 expect(obj.$attrs.ref).assertEqual(undefined) 167 console.info("[switchProps] get ref value is: " + JSON.stringify(obj.$attrs.ref)); 168 done(); 169 }); 170 171 /** 172 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 173 * @tc.name testSwitchDisabledPropTrue 174 * @tc.desc ACE 175 */ 176 it('testSwitchDisabledPropTrue', 0, async function (done) { 177 console.info('testSwitchDisabledPropTrue START'); 178 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 179 180 let obj = JSON.parse(globalThis.value.disabledPropTrue); 181 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 182 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 183 184 expect(obj.$type).assertEqual('switch') 185 expect(obj.$attrs.id).assertEqual('disabledPropTrue') 186 expect(obj.$attrs.disabled).assertEqual('true') 187 done(); 188 }); 189 190 /** 191 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 192 * @tc.name testSwitchDisabledPropFalse 193 * @tc.desc ACE 194 */ 195 it('testSwitchDisabledPropFalse', 0, async function (done) { 196 console.info('testSwitchDisabledPropFalse START'); 197 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 198 199 let obj = JSON.parse(globalThis.value.disabledPropFalse); 200 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 201 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 202 203 expect(obj.$type).assertEqual('switch') 204 expect(obj.$attrs.id).assertEqual('disabledPropFalse') 205 expect(obj.$attrs.disabled).assertEqual('false') 206 done(); 207 }); 208 209 /** 210 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 211 * @tc.name testSwitchDisabledPropNone 212 * @tc.desc ACE 213 */ 214 it('testSwitchDisabledPropNone', 0, async function (done) { 215 console.info('testSwitchDisabledPropNone START'); 216 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 217 218 let obj = JSON.parse(globalThis.value.disabledPropNone); 219 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 220 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 221 222 expect(obj.$type).assertEqual('switch') 223 expect(obj.$attrs.id).assertEqual('disabledPropNone') 224 expect(obj.$attrs.disabled).assertEqual('false') 225 done(); 226 }); 227 228 /** 229 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 230 * @tc.name testSwitchFocusablePropTrue 231 * @tc.desc ACE 232 */ 233 it('testSwitchFocusablePropTrue', 0, async function (done) { 234 console.info('testSwitchFocusablePropTrue START'); 235 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 236 237 let obj = JSON.parse(globalThis.value.focusablePropTrue); 238 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 239 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 240 241 expect(obj.$type).assertEqual('switch') 242 expect(obj.$attrs.id).assertEqual('focusablePropTrue') 243 expect(obj.$attrs.focusable).assertEqual('true') 244 done(); 245 }); 246 247 /** 248 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 249 * @tc.name testSwitchFocusablePropFalse 250 * @tc.desc ACE 251 */ 252 it('testSwitchFocusablePropFalse', 0, async function (done) { 253 console.info('testSwitchFocusablePropFalse START'); 254 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 255 256 let obj = JSON.parse(globalThis.value.focusablePropFalse); 257 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 258 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 259 260 expect(obj.$type).assertEqual('switch') 261 expect(obj.$attrs.id).assertEqual('focusablePropFalse') 262 expect(obj.$attrs.focusable).assertEqual('false') 263 done(); 264 }); 265 266 /** 267 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 268 * @tc.name testSwitchFocusablePropNone 269 * @tc.desc ACE 270 */ 271 it('testSwitchFocusablePropNone', 0, async function (done) { 272 console.info('testSwitchFocusablePropNone START'); 273 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 274 275 let obj = JSON.parse(globalThis.value.focusablePropNone); 276 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 277 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 278 279 expect(obj.$type).assertEqual('switch') 280 expect(obj.$attrs.id).assertEqual('focusablePropNone') 281 expect(obj.$attrs.focusable).assertEqual('false') 282 done(); 283 }); 284 285 /** 286 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 287 * @tc.name testSwitchDataProp 288 * @tc.desc ACE 289 */ 290 it('testSwitchDataProp', 0, async function (done) { 291 console.info('testSwitchDataProp START'); 292 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 293 294 let obj = JSON.parse(globalThis.value.dataProp); 295 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 296 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 297 298 expect(obj.$type).assertEqual('switch') 299 expect(obj.$attrs.id).assertEqual('dataProp') 300 expect(obj.$attrs.dataSwitch).assertEqual(undefined); 301 console.info("[switchProps] get dataSwitch value is: " + JSON.stringify(obj.$attrs.dataSwitch)); 302 done(); 303 }); 304 305 /** 306 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 307 * @tc.name testSwitchDataPropNone 308 * @tc.desc ACE 309 */ 310 it('testSwitchDataPropNone', 0, async function (done) { 311 console.info('testSwitchDataPropNone START'); 312 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 313 314 let obj = JSON.parse(globalThis.value.dataPropNone); 315 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 316 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 317 318 expect(obj.$type).assertEqual('switch') 319 expect(obj.$attrs.id).assertEqual('dataPropNone') 320 expect(obj.$attrs.dataSwitch).assertEqual(undefined) 321 console.info("[switchProps] get dataSwitch value is: " + JSON.stringify(obj.$attrs.dataSwitch)); 322 done(); 323 }); 324 325 /** 326 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 327 * @tc.name testSwitchClickEffectPropSmall 328 * @tc.desc ACE 329 */ 330 it('testSwitchClickEffectPropSmall', 0, async function (done) { 331 console.info('testSwitchClickEffectPropSmall START'); 332 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 333 334 let obj = JSON.parse(globalThis.value.clickEffectPropSmall); 335 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 336 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 337 338 expect(obj.$type).assertEqual('switch') 339 expect(obj.$attrs.id).assertEqual('clickEffectPropSmall') 340 expect(obj.$attrs.clickEffect).assertEqual('spring-small') 341 done(); 342 }); 343 344 /** 345 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 346 * @tc.name testSwitchClickEffectPropMedium 347 * @tc.desc ACE 348 */ 349 it('testSwitchClickEffectPropMedium', 0, async function (done) { 350 console.info('testSwitchClickEffectPropMedium START'); 351 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 352 353 let obj = JSON.parse(globalThis.value.clickEffectPropMedium); 354 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 355 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 356 357 expect(obj.$type).assertEqual('switch') 358 expect(obj.$attrs.id).assertEqual('clickEffectPropMedium') 359 expect(obj.$attrs.clickEffect).assertEqual('spring-medium') 360 done(); 361 }); 362 363 /** 364 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 365 * @tc.name testSwitchClickEffectPropLarge 366 * @tc.desc ACE 367 */ 368 it('testSwitchClickEffectPropLarge', 0, async function (done) { 369 console.info('testSwitchClickEffectPropLarge START'); 370 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 371 372 let obj = JSON.parse(globalThis.value.clickEffectPropLarge); 373 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 374 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 375 376 expect(obj.$type).assertEqual('switch') 377 expect(obj.$attrs.id).assertEqual('clickEffectPropLarge') 378 expect(obj.$attrs.clickEffect).assertEqual('spring-large') 379 done(); 380 }); 381 382 /** 383 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 384 * @tc.name testSwitchClickEffectPropNone 385 * @tc.desc ACE 386 */ 387 it('testSwitchClickEffectPropNone', 0, async function (done) { 388 console.info('testSwitchClickEffectPropNone START'); 389 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 390 391 let obj = JSON.parse(globalThis.value.clickEffectPropNone); 392 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 393 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 394 395 expect(obj.$type).assertEqual('switch') 396 expect(obj.$attrs.id).assertEqual('clickEffectPropNone') 397 expect(obj.$attrs.clickEffect).assertEqual(undefined) 398 console.info("[switchProps] get clickEffect value is: " + JSON.stringify(obj.$attrs.clickEffect)); 399 done(); 400 }); 401 402 /** 403 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 404 * @tc.name testSwitchDirPropRtl 405 * @tc.desc ACE 406 */ 407 it('testSwitchDirPropRtl', 0, async function (done) { 408 console.info('testSwitchDirPropRtl START'); 409 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 410 411 let obj = JSON.parse(globalThis.value.dirPropRtl); 412 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 413 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 414 415 expect(obj.$type).assertEqual('switch') 416 expect(obj.$attrs.id).assertEqual('dirPropRtl') 417 expect(obj.$attrs.dir).assertEqual('rtl') 418 done(); 419 }); 420 421 /** 422 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 423 * @tc.name testSwitchDirPropLtr 424 * @tc.desc ACE 425 */ 426 it('testSwitchDirPropLtr', 0, async function (done) { 427 console.info('testSwitchDirPropLtr START'); 428 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 429 430 let obj = JSON.parse(globalThis.value.dirPropLtr); 431 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 432 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 433 434 expect(obj.$type).assertEqual('switch') 435 expect(obj.$attrs.id).assertEqual('dirPropLtr') 436 expect(obj.$attrs.dir).assertEqual('ltr') 437 done(); 438 }); 439 440 /** 441 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 442 * @tc.name testSwitchDirPropAuto 443 * @tc.desc ACE 444 */ 445 it('testSwitchDirPropAuto', 0, async function (done) { 446 console.info('testSwitchDirPropAuto START'); 447 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 448 449 let obj = JSON.parse(globalThis.value.dirPropAuto); 450 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 451 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 452 453 expect(obj.$type).assertEqual('switch') 454 expect(obj.$attrs.id).assertEqual('dirPropAuto') 455 expect(obj.$attrs.dir).assertEqual('auto') 456 done(); 457 }); 458 459 /** 460 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 461 * @tc.name testSwitchDirPropNone 462 * @tc.desc ACE 463 */ 464 it('testSwitchDirPropNone', 0, async function (done) { 465 console.info('testSwitchDirPropNone START'); 466 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 467 468 let obj = JSON.parse(globalThis.value.dirPropNone); 469 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 470 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 471 472 expect(obj.$type).assertEqual('switch') 473 expect(obj.$attrs.id).assertEqual('dirPropNone') 474 expect(obj.$attrs.dir).assertEqual('auto') 475 done(); 476 }); 477 478 /** 479 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 480 * @tc.name testSwitchForPropNull 481 * @tc.desc ACE 482 */ 483 it('testSwitchForPropNull', 0, async function (done) { 484 console.info('testSwitchForPropNull START'); 485 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 486 487 let obj = JSON.parse(globalThis.value.forPropNull); 488 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 489 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 490 491 expect(obj.$type).assertEqual('switch') 492 expect(obj.$attrs.id).assertEqual('forPropNull') 493 expect(obj.$attrs.for).assertEqual(undefined) 494 console.info("[switchProps] get for value is: " + JSON.stringify(obj.$attrs.for)); 495 done(); 496 }); 497 498 /** 499 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 500 * @tc.name testSwitchForPropOne 501 * @tc.desc ACE 502 */ 503 it('testSwitchForPropOne', 0, async function (done) { 504 console.info('testSwitchForPropOne START'); 505 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 506 507 let obj = JSON.parse(globalThis.value.forPropOne); 508 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 509 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 510 511 expect(obj.$type).assertEqual('switch') 512 expect(obj.$attrs.id).assertEqual('forPropOne') 513 expect(obj.$attrs.for).assertEqual(undefined) 514 console.info("[switchProps] get for value is: " + JSON.stringify(obj.$attrs.for)); 515 done(); 516 }); 517 518 /** 519 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 520 * @tc.name testSwitchForPropThree 521 * @tc.desc ACE 522 */ 523 it('testSwitchForPropThree', 0, async function (done) { 524 console.info('testSwitchForPropThree START'); 525 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 526 527 let obj = JSON.parse(globalThis.value.forPropThree); 528 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 529 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 530 531 expect(obj.$type).assertEqual('switch') 532 expect(obj.$attrs.id).assertEqual('forPropThree') 533 expect(obj.$attrs.for).assertEqual(undefined) 534 console.info("[switchProps] get for value is: " + JSON.stringify(obj.$attrs.for)); 535 done(); 536 }); 537 538 /** 539 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 540 * @tc.name testSwitchIfPropTrue 541 * @tc.desc ACE 542 */ 543 it('testSwitchIfPropTrue', 0, async function (done) { 544 console.info('testSwitchIfPropTrue START'); 545 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 546 547 let obj = JSON.parse(globalThis.value.ifPropTrue); 548 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 549 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 550 551 expect(obj.$type).assertEqual('switch') 552 expect(obj.$attrs.id).assertEqual('ifPropTrue') 553 expect(obj.$attrs.if).assertEqual(undefined) 554 console.info("[switchProps] get for value is: " + JSON.stringify(obj.$attrs.if)); 555 done(); 556 }); 557 558 /** 559 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 560 * @tc.name testSwitchShowPropTrue 561 * @tc.desc ACE 562 */ 563 it('testSwitchShowPropTrue', 0, async function (done) { 564 console.info('testSwitchShowPropTrue START'); 565 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 566 567 let obj = JSON.parse(globalThis.value.showPropTrue); 568 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 569 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 570 571 expect(obj.$type).assertEqual('switch') 572 expect(obj.$attrs.id).assertEqual('showPropTrue') 573 expect(obj.$attrs.show).assertEqual('true') 574 console.info("[switchProps] get show value is: " + JSON.stringify(obj.$attrs.show)); 575 done(); 576 }); 577 578 /** 579 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 580 * @tc.name testSwitchShowPropFalse 581 * @tc.desc ACE 582 */ 583 it('testSwitchShowPropFalse', 0, async function (done) { 584 console.info('testSwitchShowPropFalse START'); 585 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 586 587 let obj = JSON.parse(globalThis.value.showPropFalse); 588 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 589 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 590 591 expect(obj.$type).assertEqual('switch') 592 expect(obj.$attrs.id).assertEqual('showPropFalse') 593 expect(obj.$attrs.show).assertEqual('false') 594 console.info("[switchProps] get show value is: " + JSON.stringify(obj.$attrs.show)); 595 done(); 596 }); 597 598 /** 599 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 600 * @tc.name testSwitchShowPropNone 601 * @tc.desc ACE 602 */ 603 it('testSwitchShowPropNone', 0, async function (done) { 604 console.info('testSwitchShowPropNone START'); 605 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 606 607 let obj = JSON.parse(globalThis.value.showPropNone); 608 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 609 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 610 611 expect(obj.$type).assertEqual('switch') 612 expect(obj.$attrs.id).assertEqual('showPropNone') 613 expect(obj.$attrs.show).assertEqual('true') 614 console.info("[switchProps] get show value is: " + JSON.stringify(obj.$attrs.show)); 615 done(); 616 }); 617 618 // 特有属性 619 620 /** 621 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 622 * @tc.name testSwitchCheckedTrue 623 * @tc.desc ACE 624 */ 625 it('testSwitchCheckedTrue', 0, async function (done) { 626 console.info('testSwitchCheckedTrue START'); 627 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 628 629 let obj = JSON.parse(globalThis.value.checkedTrue); 630 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 631 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 632 633 expect(obj.$type).assertEqual('switch') 634 expect(obj.$attrs.id).assertEqual('checkedTrue') 635 expect(obj.$attrs.checked).assertEqual('true') 636 console.info("[switchProps] get checked value is: " + JSON.stringify(obj.$attrs.checked)); 637 done(); 638 }); 639 640 /** 641 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 642 * @tc.name testSwitchCheckedFalse 643 * @tc.desc ACE 644 */ 645 it('testSwitchCheckedFalse', 0, async function (done) { 646 console.info('testSwitchCheckedFalse START'); 647 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 648 649 let obj = JSON.parse(globalThis.value.checkedFalse); 650 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 651 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 652 653 expect(obj.$type).assertEqual('switch') 654 expect(obj.$attrs.id).assertEqual('checkedFalse') 655 expect(obj.$attrs.checked).assertEqual('false') 656 console.info("[switchProps] get checked value is: " + JSON.stringify(obj.$attrs.checked)); 657 done(); 658 }); 659 660 /** 661 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 662 * @tc.name testSwitchCheckedNone 663 * @tc.desc ACE 664 */ 665 it('testSwitchCheckedNone', 0, async function (done) { 666 console.info('testSwitchCheckedNone START'); 667 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 668 669 let obj = JSON.parse(globalThis.value.checkedNone); 670 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 671 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 672 673 expect(obj.$type).assertEqual('switch') 674 expect(obj.$attrs.id).assertEqual('checkedNone') 675 expect(obj.$attrs.checked).assertEqual('false') 676 console.info("[switchProps] get checked value is: " + JSON.stringify(obj.$attrs.checked)); 677 done(); 678 }); 679 680 /** 681 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 682 * @tc.name testSwitchShowTextTrue 683 * @tc.desc ACE 684 */ 685 it('testSwitchShowTextTrue', 0, async function (done) { 686 console.info('testSwitchShowTextTrue START'); 687 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 688 689 let obj = JSON.parse(globalThis.value.showTextTrue); 690 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 691 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 692 693 expect(obj.$type).assertEqual('switch') 694 expect(obj.$attrs.id).assertEqual('showTextTrue') 695 expect(obj.$attrs.showtext).assertEqual("true") 696 console.info("[switchProps] get showtext value is: " + JSON.stringify(obj.$attrs.showtext)); 697 done(); 698 }); 699 700 /** 701 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 702 * @tc.name testSwitchShowTextFalse 703 * @tc.desc ACE 704 */ 705 it('testSwitchShowTextFalse', 0, async function (done) { 706 console.info('testSwitchShowTextFalse START'); 707 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 708 709 let obj = JSON.parse(globalThis.value.showTextFalse); 710 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 711 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 712 713 expect(obj.$type).assertEqual('switch') 714 expect(obj.$attrs.id).assertEqual('showTextFalse') 715 expect(obj.$attrs.showtext).assertEqual("false") 716 console.info("[switchProps] get showtext value is: " + JSON.stringify(obj.$attrs.showtext)); 717 done(); 718 }); 719 720 /** 721 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 722 * @tc.name testSwitchShowTextNone 723 * @tc.desc ACE 724 */ 725 it('testSwitchShowTextNone', 0, async function (done) { 726 console.info('testSwitchShowTextNone START'); 727 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 728 729 let obj = JSON.parse(globalThis.value.showTextNone); 730 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 731 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 732 733 expect(obj.$type).assertEqual('switch') 734 expect(obj.$attrs.id).assertEqual('showTextNone') 735 expect(obj.$attrs.showtext).assertEqual('false') 736 console.info("[switchProps] get showtext value is: " + JSON.stringify(obj.$attrs.showtext)); 737 done(); 738 }); 739 740 /** 741 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 742 * @tc.name testSwitchTextOn 743 * @tc.desc ACE 744 */ 745 it('testSwitchTextOn', 0, async function (done) { 746 console.info('testSwitchTextOn START'); 747 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 748 749 let obj = JSON.parse(globalThis.value.textOn); 750 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 751 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 752 753 expect(obj.$type).assertEqual('switch') 754 expect(obj.$attrs.id).assertEqual('textOn') 755 expect(obj.$attrs.texton).assertEqual("开") 756 console.info("[switchProps] get texton value is: " + JSON.stringify(obj.$attrs.texton)); 757 done(); 758 }); 759 760 /** 761 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 762 * @tc.name testSwitchTextOnNone 763 * @tc.desc ACE 764 */ 765 it('testSwitchTextOnNone', 0, async function (done) { 766 console.info('testSwitchTextOnNone START'); 767 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 768 769 let obj = JSON.parse(globalThis.value.textOnNone); 770 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 771 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 772 773 expect(obj.$type).assertEqual('switch') 774 expect(obj.$attrs.id).assertEqual('textOnNone') 775 expect(obj.$attrs.texton).assertEqual('On') 776 console.info("[switchProps] get texton value is: " + JSON.stringify(obj.$attrs.texton)); 777 done(); 778 }); 779 780 /** 781 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 782 * @tc.name testSwitchTextOff 783 * @tc.desc ACE 784 */ 785 it('testSwitchTextOff', 0, async function (done) { 786 console.info('testSwitchTextOff START'); 787 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 788 789 let obj = JSON.parse(globalThis.value.textOff); 790 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 791 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 792 793 expect(obj.$type).assertEqual('switch') 794 expect(obj.$attrs.id).assertEqual('textOff') 795 expect(obj.$attrs.textoff).assertEqual("关") 796 console.info("[switchProps] get textoff value is: " + JSON.stringify(obj.$attrs.textoff)); 797 done(); 798 }); 799 800 /** 801 * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 802 * @tc.name testSwitchTextOffNone 803 * @tc.desc ACE 804 */ 805 it('testSwitchTextOffNone', 0, async function (done) { 806 console.info('testSwitchTextOffNone START'); 807 console.info("[switchProps] get globalThis.value is: " + JSON.stringify(globalThis.value)); 808 809 let obj = JSON.parse(globalThis.value.textOffNone); 810 console.info("[switchProps] get inspector value is: " + JSON.stringify(obj)); 811 console.info("[switchProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); 812 813 expect(obj.$type).assertEqual('switch') 814 expect(obj.$attrs.id).assertEqual('textOffNone') 815 expect(obj.$attrs.textoff).assertEqual('Off') 816 console.info("[switchProps] get textoff value is: " + JSON.stringify(obj.$attrs.textoff)); 817 done(); 818 }); 819});} 820