How to use remove method in storybook-root

Best JavaScript code snippet using storybook-root

ActsAnsNotificationRemove.test.js

Source:ActsAnsNotificationRemove.test.js Github

copy

Full Screen

...26 console.info("=============ANS_Remove_0100 onConsume start=======================>");27 console.info("=============ANS_Remove_0100 onConsume data:==================>" + JSON.stringify(data));28 console.info("=============ANS_Remove_0100 onConsume hascode:===============>" + data.request.hashCode);29 hashCode = data.request.hashCode30 notify.remove(hashCode,removeCallBack);31 console.info("=============ANS_Remove_0100 onConsume remove=======================>");32 console.info("=============ANS_Remove_0100 onConsume end=======================>");33 }34 function onCancelRemove(data) {35 console.info("==========ANS_Remove_0100 onCancel start==================>");36 console.info("==========ANS_Remove_0100 onCancel data : ================>" + JSON.stringify(data));37 console.info("==========ANS_Remove_0100 onCancel hashCode===============>" + hashCode);38 console.info("==========ANS_Remove_0100 onCancel data.request.hashCode==>" + data.request.hashCode);39 expect(hashCode).assertEqual(data.request.hashCode);40 console.info("==========ANS_Remove_0100 onCancel end=======================>");41 }42 function removeCallBack(err, data) {43 console.info("==========ANS_Remove_0100 removeCallBack err=========>" + JSON.stringify(err));44 console.info("==========ANS_Remove_0100 removeCallBack data : =======================>" + JSON.stringify(data));45 }46 function subscriberCallBack(err, data) {47 console.info("================subscriberCallBack err : =======================>" + JSON.stringify(err));48 console.info("================subscriberCallBack data : =======================>" + JSON.stringify(data));49 }50 function publishCallback(err, data) {51 console.info("================publishCallback err : =======================>" + JSON.stringify(err));52 console.info("================publishCallback data : =======================>" + JSON.stringify(data));53 }54 /*55 * @tc.number: ANS_Remove_010056 * @tc.name: remove(hashCode: string, callback: AsyncCallback<void>): void;57 * @tc.desc: Verify that the call interface remove(hashCode: string, callback: AsyncCallback<void>): void58 deletes the notification information through hashcode59 */60 it('ANS_Remove_0100', 0, async function (done) {61 console.info("===============ANS_Remove_0100==========================>");62 hashCode = 063 var subscriber ={64 onConsume:onConsumeRemove,65 onCancel:onCancelRemove,66 }67 await notify.subscribe(subscriber);68 console.info("==================ANS_Remove_0100 subscribe promise==================>");69 var notificationRequest = {70 content:{71 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,72 normal: {73 title: "test_title",74 text: "test_text",75 additionalText: "test_additionalText"76 },77 },78 id: 1,79 slotType : notify.SlotType.OTHER_TYPES,80 isOngoing : true,81 isUnremovable : false,82 deliveryTime : 1624950453,83 tapDismissed : true,84 autoDeletedTime: 1625036817,85 color: 2,86 colorEnabled: true,87 isAlertOnce: true,88 isStopwatch: true,89 isCountDown: true,90 progressValue: 12,91 progressMaxValue: 100,92 isIndeterminate: true,93 statusBarText: "statusBarText",94 isFloatingIcon : true,95 label: "0100",96 badgeIconStyle: 1,97 showDeliveryTime: true,98 }99 await notify.publish(notificationRequest);100 console.info("=============ANS_Remove_0100 publish promise===========>");101 setTimeout((async function(){102 console.info("======ANS_Remove_0100 setTimeout==================>");103 await notify.unsubscribe(subscriber);104 console.info("======ANS_Remove_0100 setTimeout unsubscribe==================>");105 await notify.cancelAll();106 done();107 }),timeout);108 })109 function onConsumeRemovePromise(data) {110 console.info("================ANS_Remove_0200 onConsume start===============>");111 console.info("================ANS_Remove_0200 onConsume data================>" + JSON.stringify(data));112 hashCode = data.request.hashCode113 console.info("================ANS_Remove_0200 onConsume hascode:========>" + data.request.hashCode);114 notify.remove(hashCode);115 console.info("================ANS_Remove_0200 onConsume remove============>");116 console.info("================ANS_Remove_0200 onConsume end===============>");117 }118 function onCancelRemovePromise(data) {119 console.info("===========ANS_Remove_0200 onCancel start================>");120 console.info("===========ANS_Remove_0200 onCancel data:=================>" + JSON.stringify(data));121 console.info("===========ANS_Remove_0200 onCancel hashCode====================>" + hashCode);122 console.info("===========ANS_Remove_0200 onCancel data.request.hashCode=======>" + data.request.hashCode);123 expect(hashCode).assertEqual(data.request.hashCode);124 console.info("===========ANS_Remove_0200 onCancel end===================>");125 }126 /*127 * @tc.number: ANS_Remove_0200128 * @tc.name: remove(hashCode: string): Promise<void>;129 * @tc.desc: Verify that the call interface remove(hashCode: string): Promise<void>130 deletes the notification information through hashcode131 */132 it('ANS_Remove_0200', 0, async function (done) {133 console.info("===============ANS_Remove_0200==========================>");134 hashCode = 0135 var subscriber ={136 onConsume:onConsumeRemovePromise,137 onCancel:onCancelRemovePromise,138 }139 await notify.subscribe(subscriber);140 console.info("===============ANS_Remove_0200 subscribe promise==================>");141 var notificationRequest = {142 content:{143 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,144 normal: {145 title: "test_title",146 text: "test_text",147 additionalText: "test_additionalText"148 },149 },150 id: 2,151 slotType : notify.SlotType.OTHER_TYPES,152 isOngoing : true,153 isUnremovable : false,154 deliveryTime : 1624950453,155 tapDismissed : true,156 autoDeletedTime: 1625036817,157 color: 2,158 colorEnabled: true,159 isAlertOnce: true,160 isStopwatch: true,161 isCountDown: true,162 progressValue: 12,163 progressMaxValue: 100,164 isIndeterminate: true,165 statusBarText: "statusBarText",166 isFloatingIcon : true,167 label: "0200",168 badgeIconStyle: 1,169 showDeliveryTime: true,170 }171 await notify.publish(notificationRequest);172 console.info("======ANS_Remove_0200 publish==================>");173 setTimeout((async function(){174 console.info("======ANS_Remove_0200 setTimeout============>");175 await notify.unsubscribe(subscriber);176 console.info("======ANS_Remove_0200 setTimeout unsubscribe============>");177 await notify.cancelAll();178 done();179 }),timeout);180 })181 function onConsumeRemoveErrHashCode(data) {182 console.info("================ANS_Remove_0300 onConsume start=======================>");183 console.info("================ANS_Remove_0300 onConsume data:=============>" + JSON.stringify(data));184 notify.remove("errorHashCode",removeErrHashCodeCallBack);185 console.info("================ANS_Remove_0300 onConsume remove=======================>");186 console.info("================ANS_Remove_0300 onConsume end=======================>");187 }188 function onCancelRemoveErrHashCode() {189 console.info("================ANS_Remove_0300 onCancel start=======================>");190 expect().assertFail();191 console.info("================ANS_Remove_0300 onCancel end=======================>");192 }193 function removeErrHashCodeCallBack(err,data) {194 console.info("==========ANS_Remove_0300 removeCallBack start==============>");195 console.info("==========ANS_Remove_0300 removeCallBack err====================>" + JSON.stringify(err));196 console.info("==========ANS_Remove_0300 removeCallBack data===============>" + JSON.stringify(data));197 expect(err.code != 0).assertEqual(true);198 console.info("==========ANS_Remove_0300 removeCallBack end=======================>");199 }200 /*201 * @tc.number: ANS_Remove_0300202 * @tc.name: remove(hashCode: string, callback: AsyncCallback<void>): void203 * @tc.desc: Verify that the error hashcode is used to call the interface204 remove(hashCode: string, callback: AsyncCallback<void>) to delete the notification information205 */206 it('ANS_Remove_0300', 0, async function (done) {207 console.info("===============ANS_Remove_0300==========================>");208 var subscriber ={209 onConsume:onConsumeRemoveErrHashCode,210 onCancel:onCancelRemoveErrHashCode,211 }212 await notify.subscribe(subscriber);213 console.info("==================ANS_Remove_0300 subscribe promise==================>");214 var notificationRequest = {215 content:{216 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,217 normal: {218 title: "test_title",219 text: "test_text",220 additionalText: "test_additionalText"221 },222 },223 id: 3,224 slotType : notify.SlotType.OTHER_TYPES,225 isOngoing : true,226 isUnremovable : false,227 deliveryTime : 1624950453,228 tapDismissed : true,229 autoDeletedTime: 1625036817,230 color: 2,231 colorEnabled: true,232 isAlertOnce: true,233 isStopwatch: true,234 isCountDown: true,235 progressValue: 12,236 progressMaxValue: 100,237 isIndeterminate: true,238 statusBarText: "statusBarText",239 isFloatingIcon : true,240 label: "0300",241 badgeIconStyle: 1,242 showDeliveryTime: true,243 }244 await notify.publish(notificationRequest);245 console.info("==================ANS_Remove_0300 publish promise==================>");246 setTimeout((async function(){247 console.info("======ANS_Remove_0300 setTimeout============>");248 await notify.unsubscribe(subscriber);249 console.info("======ANS_Remove_0300 setTimeout unsubscribe============>");250 await notify.cancelAll()251 done();252 }),timeout);253 })254 function onConsumeRemoveErrHashCodePromise(data) {255 console.info("===========ANS_Remove_0400 onConsume start:===========>");256 console.info("===========ANS_Remove_0400 onConsume data:===========>" + JSON.stringify(data));257 notify.remove("errorHashCode");258 console.info("===========ANS_Remove_0400 onConsume remove:===========>");259 console.info("===========ANS_Remove_0400 onConsume end:===========>");260 }261 function onCancelRemoveErrHashCodePromise() {262 console.info("===========ANS_Remove_0400 onCancel start:===========>");263 expect().assertFail();264 console.info("===========ANS_Remove_0400 onCancel end:===========>");265 }266 /*267 * @tc.number: ANS_Remove_0400268 * @tc.name: remove(hashCode: string): Promise<void>269 * @tc.desc: Verify that the error hashcode is used to call the interface270 remove(hashCode: string): Promise<void> to delete the notification information271 */272 it('ANS_Remove_0400', 0, async function (done) {273 console.info("===============ANS_Remove_0400==========================>");274 var subscriber ={275 onConsume:onConsumeRemoveErrHashCodePromise,276 onCancel:onCancelRemoveErrHashCodePromise,277 }278 await notify.subscribe(subscriber);279 console.info("===============ANS_Remove_0400 subscribe promise==================>");280 var notificationRequest = {281 content:{282 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,283 normal: {284 title: "test_title",285 text: "test_text",286 additionalText: "test_additionalText"287 },288 },289 id: 4,290 slotType : notify.SlotType.OTHER_TYPES,291 isOngoing : true,292 isUnremovable : false,293 deliveryTime : 1624950453,294 tapDismissed : true,295 autoDeletedTime: 1625036817,296 color: 2,297 colorEnabled: true,298 isAlertOnce: true,299 isStopwatch: true,300 isCountDown: true,301 progressValue: 12,302 progressMaxValue: 100,303 isIndeterminate: true,304 statusBarText: "statusBarText",305 isFloatingIcon : true,306 label: "0400",307 badgeIconStyle: 1,308 showDeliveryTime: true,309 }310 await notify.publish(notificationRequest);311 console.info("==================ANS_Remove_0400 publish promise==================>");312 setTimeout((async function(){313 console.info("======ANS_Remove_0400 setTimeout============>");314 await notify.unsubscribe(subscriber);315 console.info("======ANS_Remove_0400 setTimeout unsubscribe============>");316 await notify.cancelAll();317 done();318 }),timeout);319 })320 function onConsumeRemoveUseEmptyCharacter(data) {321 console.info("================ANS_Remove_0500 onConsume start==============>");322 console.info("================ANS_Remove_0500 onConsume data:==============>" + JSON.stringify(data));323 notify.remove('',removeCallBackUseEmptyCharacter);324 console.info("================ANS_Remove_0500 onConsume remove=============>");325 console.info("================ANS_Remove_0500 onConsume end================>");326 }327 function onCancelRemoveUseEmptyCharacter(data) {328 console.info("=============ANS_Remove_0500 onCancel start===============>");329 console.info("=============ANS_Remove_0500 onCancel data:===============>" + JSON.stringify(data));330 expect().assertFail();331 console.info("=============ANS_Remove_0500 onCancel end=================>");332 }333 function removeCallBackUseEmptyCharacter(err) {334 console.info("=============ANS_Remove_0500 removeCallBack start===============>");335 console.info("=============ANS_Remove_0500 removeCallBack err=================>" + JSON.stringify(err));336 expect(err.code != 0).assertEqual(true);337 console.info("=============ANS_Remove_0500 removeCallBack end=================>");338 }339 /*340 * @tc.number: ANS_Remove_0500341 * @tc.name: remove(hashCode: string, callback: AsyncCallback<void>): void;342 * @tc.desc: Verify that the Empty Character hashcode is used to call the interface343 remove(hashCode: string, callback: AsyncCallback<void>): void344 to delete the notification information345 */346 it('ANS_Remove_0500', 0, async function (done) {347 console.info("===============ANS_Remove_0500==========================>");348 var subscriber ={349 onConsume:onConsumeRemoveUseEmptyCharacter,350 onCancel:onCancelRemoveUseEmptyCharacter,351 }352 await notify.subscribe(subscriber);353 console.info("==================ANS_Remove_0500 subscribe promise==================>");354 var notificationRequest = {355 content:{356 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,357 normal: {358 title: "test_title",359 text: "test_text",360 additionalText: "test_additionalText"361 },362 },363 id: 5,364 slotType : notify.SlotType.OTHER_TYPES,365 isOngoing : true,366 isUnremovable : false,367 deliveryTime : 1624950453,368 tapDismissed : true,369 autoDeletedTime: 1625036817,370 color: 2,371 colorEnabled: true,372 isAlertOnce: true,373 isStopwatch: true,374 isCountDown: true,375 progressValue: 12,376 progressMaxValue: 100,377 isIndeterminate: true,378 statusBarText: "statusBarText",379 isFloatingIcon : true,380 label: "0500",381 badgeIconStyle: 1,382 showDeliveryTime: true,383 }384 await notify.publish(notificationRequest);385 console.info("==================ANS_Remove_0500 publish promise==================>");386 setTimeout((async function(){387 console.info("======ANS_Remove_0500 setTimeout============>");388 await notify.unsubscribe(subscriber);389 console.info("======ANS_Remove_0500 setTimeout unsubscribe============>");390 await notify.cancelAll();391 done();392 }),timeout);393 })394 function OnConsumeRemoveUseEmptyCharacterPromise(data) {395 console.info("================ANS_Remove_0600 onConsume start=======================>");396 console.info("================ANS_Remove_0600 onConsume data:==================>" + JSON.stringify(data));397 notify.remove('',removeCallBackUseEmptyCharacter);398 console.info("================ANS_Remove_0600 onConsume remove=======================>");399 console.info("================ANS_Remove_0600 onConsume end=======================>");400 }401 function OnCancelRemoveUseEmptyCharacterPromise(data) {402 console.info("==============ANS_Remove_0600 onCancel start=============>");403 console.info("==============ANS_Remove_0600 onCancel data:=============>" + JSON.stringify(data));404 expect().assertFail();405 console.info("==============ANS_Remove_0600 onCancel end===============>");406 }407 /*408 * @tc.number: ANS_Remove_0600409 * @tc.name: remove(hashCode: string): Promise<void>;410 * @tc.desc: Verify that the Empty Character hashcode is used to call the interface411 remove(hashCode: string): Promise<void> to delete the notification information412 */413 it('ANS_Remove_0600', 0, async function (done) {414 console.info("===============ANS_Remove_0600 start==========================>");415 var subscriber ={416 onConsume:OnConsumeRemoveUseEmptyCharacterPromise,417 onCancel:OnCancelRemoveUseEmptyCharacterPromise,418 }419 await notify.subscribe(subscriber);420 console.info("==================ANS_Remove_0600 subscribe promise==================>");421 var notificationRequest = {422 content:{423 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,424 normal: {425 title: "test_title",426 text: "test_text",427 additionalText: "test_additionalText"428 },429 },430 id: 6,431 slotType : notify.SlotType.OTHER_TYPES,432 isOngoing : true,433 isUnremovable : false,434 deliveryTime : 1624950453,435 tapDismissed : true,436 autoDeletedTime: 1625036817,437 color: 2,438 colorEnabled: true,439 isAlertOnce: true,440 isStopwatch: true,441 isCountDown: true,442 progressValue: 12,443 progressMaxValue: 100,444 isIndeterminate: true,445 statusBarText: "statusBarText",446 isFloatingIcon : true,447 label: "0600",448 badgeIconStyle: 1,449 showDeliveryTime: true,450 }451 await notify.publish(notificationRequest);452 console.info("==================ANS_Remove_0600 publish promise==================>");453 setTimeout((async function(){454 console.info("======ANS_Remove_0600 setTimeout============>");455 await notify.unsubscribe(subscriber);456 console.info("======ANS_Remove_0600 setTimeout unsubscribe============>");457 await notify.cancelAll();458 done();459 }),timeout);460 })461 function onConsumeRemoveNotExistHashCode(data) {462 console.info("==============ANS_Remove_0700 onConsume start===================>");463 console.info("==============ANS_Remove_0700 onConsume data:===================>" + JSON.stringify(data));464 notify.remove("9999_9999_9",removeNotExistHashCodeCallBack);465 console.info("==============ANS_Remove_0700 onConsume remove===================>");466 console.info("==============ANS_Remove_0700 onConsume end===================>");467 }468 function onCancelRemoveNotExistHashCode(data) {469 console.info("==============ANS_Remove_0700 onCancel start=======================>");470 console.info("==============ANS_Remove_0700 onCancel data:============>" + JSON.stringify(data));471 expect().assertFail();472 console.info("==============ANS_Remove_0700 onCancel end=======================>");473 }474 function removeNotExistHashCodeCallBack(err) {475 console.info("==========ANS_Remove_0700 removeCallBack start==========>");476 console.info("==========ANS_Remove_0700 removeCallBack err=================>" + JSON.stringify(err));477 expect(err.code != 0).assertEqual(true);478 console.info("==========ANS_Remove_0700 removeCallBack end=======================>");479 }480 /*481 * @tc.number: ANS_Remove_0700482 * @tc.name: remove(hashCode: string, callback: AsyncCallback<void>): void;483 * @tc.desc: Verify that the not exist hashCode is used to call the interface484 * remove(hashCode: string, callback: AsyncCallback<void>): void485 * to delete the notification information486 */487 it('ANS_Remove_0700', 0, async function (done) {488 console.info("===============ANS_Remove_0700==========================>");489 var subscriber ={490 onConsume:onConsumeRemoveNotExistHashCode,491 onCancel:onCancelRemoveNotExistHashCode,492 }493 await notify.subscribe(subscriber);494 console.info("================ANS_Remove_0700 subscribe promise=======>");495 var notificationRequest = {496 content:{497 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,498 normal: {499 title: "test_title",500 text: "test_text",501 additionalText: "test_additionalText"502 },503 },504 id: 7,505 slotType : notify.SlotType.OTHER_TYPES,506 isOngoing : true,507 isUnremovable : false,508 deliveryTime : 1624950453,509 tapDismissed : true,510 autoDeletedTime: 1625036817,511 color: 2,512 colorEnabled: true,513 isAlertOnce: true,514 isStopwatch: true,515 isCountDown: true,516 progressValue: 12,517 progressMaxValue: 100,518 isIndeterminate: true,519 statusBarText: "statusBarText",520 isFloatingIcon : true,521 label: "0700",522 badgeIconStyle: 1,523 showDeliveryTime: true,524 }525 await notify.publish(notificationRequest);526 console.info("============ANS_Remove_0700 publish promise==================>");527 setTimeout((async function(){528 console.info("======ANS_Remove_0700 setTimeout============>");529 await notify.unsubscribe(subscriber);530 console.info("======ANS_Remove_0700 setTimeout unsubscribe============>");531 await notify.cancelAll();532 done();533 }),timeout);534 })535 function onConsumeRemoveNotExistHashCodePromise(data) {536 console.info("================ANS_Remove_0800 onConsume start=======================>");537 console.info("================ANS_Remove_0800 onConsume data:===============>" + JSON.stringify(data));538 notify.remove("9999_9999_9");539 console.info("================ANS_Remove_0800 onConsume remove====================>");540 console.info("================ANS_Remove_0800 onConsume end=======================>");541 }542 function onCancelRemoveNotExistHashCodePromise(data) {543 console.info("============ANS_Remove_0800 onCancel start===============>");544 console.info("============ANS_Remove_0800 onCancel data:===============>" + JSON.stringify(data));545 expect().assertFail();546 console.info("============ANS_Remove_0800 onCancel end=================>");547 }548 /*549 * @tc.number: ANS_Remove_0800550 * @tc.name: remove(hashCode: string): Promise<void>;551 * @tc.desc: Verify that the not exist hashCode is used to call the interface remove(hashCode: string,552 * callback: AsyncCallback<void>): void to delete the notification information553 */554 it('ANS_Remove_0800', 0, async function (done) {555 console.info("===============ANS_Remove_0800==========================>");556 var subscriber ={557 onConsume:onConsumeRemoveNotExistHashCodePromise,558 onCancel:onCancelRemoveNotExistHashCodePromise,559 }560 await notify.subscribe(subscriber);561 console.info("================ANS_Remove_0800 subscribe promise=======>");562 var notificationRequest = {563 content:{564 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,565 normal: {566 title: "test_title",567 text: "test_text",568 additionalText: "test_additionalText"569 },570 },571 id: 8,572 slotType : notify.SlotType.OTHER_TYPES,573 isOngoing : true,574 isUnremovable : false,575 deliveryTime : 1624950453,576 tapDismissed : true,577 autoDeletedTime: 1625036817,578 color: 2,579 colorEnabled: true,580 isAlertOnce: true,581 isStopwatch: true,582 isCountDown: true,583 progressValue: 12,584 progressMaxValue: 100,585 isIndeterminate: true,586 statusBarText: "statusBarText",587 isFloatingIcon : true,588 label: "0800",589 badgeIconStyle: 1,590 showDeliveryTime: true,591 }592 await notify.publish(notificationRequest);593 console.info("==========ANS_Remove_0800 publish promise==================>");594 setTimeout((async function(){595 console.info("======ANS_Remove_0800 setTimeout============>");596 await notify.unsubscribe(subscriber);597 console.info("======ANS_Remove_0800 setTimeout unsubscribe============>");598 await notify.cancelAll()599 done();600 }),timeout);601 })602 function onConsumeRemoveNonComplianceHashCode(data) {603 console.info("================ANS_Remove_0900 onConsume start===================>");604 console.info("================ANS_Remove_0900 onConsume data: ==================>" + JSON.stringify(data));605 notify.remove("Γ₯Β“ΒˆΓ₯¸Œç ",removeNonComplianceHashCallBack);606 console.info("================ANS_Remove_0900 onConsume remove==================>");607 console.info("================ANS_Remove_0900 onConsume end=====================>");608 }609 function onCancelRemoveNonComplianceHashCode(data) {610 console.info("================ANS_Remove_0900 onCancel start====================>");611 console.info("================ANS_Remove_0900 onCancel data:====================>" + JSON.stringify(data));612 expect().assertFail();613 console.info("================ANS_Remove_0900 onCancel end======================>");614 }615 function removeNonComplianceHashCallBack(err, data) {616 console.info("================ANS_Remove_0900 removeCallBack start=======================>");617 console.info("================ANS_Remove_0900 removeCallBack err=================>" + JSON.stringify(err));618 console.info("================ANS_Remove_0900 removeCallBack data=================>" + JSON.stringify(data));619 console.info("================ANS_Remove_0900 removeCallBack end=======================>");620 expect(err.code != 0).assertEqual(true);621 }622 /*623 * @tc.number: ANS_Remove_0900624 * @tc.name: remove(hashCode: string, callback: AsyncCallback<void>): void;625 * @tc.desc: Verify that the non compliance hashCode is used to call the interface remove(hashCode: string,626 * callback: AsyncCallback<void>): void to delete the notification information627 */628 it('ANS_Remove_0900', 0, async function (done) {629 console.info("===============ANS_Remove_0900==========================>");630 var subscriber ={631 onConsume:onConsumeRemoveNonComplianceHashCode,632 onCancel:onCancelRemoveNonComplianceHashCode,633 }634 await notify.subscribe(subscriber);635 console.info("============ANS_Remove_0900 subscribe promise==================>");636 var notificationRequest = {637 content:{638 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,639 normal: {640 title: "test_title",641 text: "test_text",642 additionalText: "test_additionalText"643 },644 },645 id: 9,646 slotType : notify.SlotType.OTHER_TYPES,647 isOngoing : true,648 isUnremovable : false,649 deliveryTime : 1624950453,650 tapDismissed : true,651 autoDeletedTime: 1625036817,652 color: 2,653 colorEnabled: true,654 isAlertOnce: true,655 isStopwatch: true,656 isCountDown: true,657 progressValue: 12,658 progressMaxValue: 100,659 isIndeterminate: true,660 statusBarText: "statusBarText",661 isFloatingIcon : true,662 label: "0900",663 badgeIconStyle: 1,664 showDeliveryTime: true,665 }666 await notify.publish(notificationRequest);667 console.info("==================ANS_Remove_0900 publish promise==================>");668 setTimeout((async function(){669 console.info("======ANS_Remove_0900 setTimeout============>");670 await notify.unsubscribe(subscriber);671 console.info("======ANS_Remove_0900 setTimeout unsubscribe============>");672 await notify.cancelAll();673 done();674 }),timeout);675 })676 function onConsumeRemoveNonComplianceHashCodePromise(data) {677 console.info("================ANS_Remove_1000 onConsume start===========>");678 console.info("================ANS_Remove_1000 onConsume data:===========>" + JSON.stringify(data));679 notify.remove("Γ₯Β“ΒˆΓ₯¸Œç ");680 console.info("================ANS_Remove_1000 onConsume remove==========>");681 console.info("================ANS_Remove_1000 onConsume end=============>");682 }683 function onCancelRemoveNonComplianceHashCodePromise(data) {684 console.info("================ANS_Remove_1000 onCancel start==================>");685 console.info("================ANS_Remove_1000 onCancel data:==================>" + JSON.stringify(data));686 expect().assertFail();687 console.info("================ANS_Remove_1000 onCancel end====================>");688 }689 /*690 * @tc.number: ANS_Remove_1000691 * @tc.name: remove(hashCode: string, callback: AsyncCallback<void>): void;692 * @tc.desc: Verify that the non compliance hashCode is used to call the interface693 remove(hashCode: string, callback: AsyncCallback<void>): void to delete the notification information694 */695 it('ANS_Remove_1000', 0, async function (done) {696 console.info("===============ANS_Remove_1000==========================>");697 var subscriber ={698 onConsume:onConsumeRemoveNonComplianceHashCodePromise,699 onCancel:onCancelRemoveNonComplianceHashCodePromise,700 }701 await notify.subscribe(subscriber);702 console.info("================ANS_Remove_1000 subscribe promise==================>");703 var notificationRequest = {704 content:{705 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,706 normal: {707 title: "test_title",708 text: "test_text",709 additionalText: "test_additionalText"710 },711 },712 id: 10,713 slotType : notify.SlotType.OTHER_TYPES,714 isOngoing : true,715 isUnremovable : false,716 deliveryTime : 1624950453,717 tapDismissed : true,718 autoDeletedTime: 1625036817,719 color: 2,720 colorEnabled: true,721 isAlertOnce: true,722 isStopwatch: true,723 isCountDown: true,724 progressValue: 12,725 progressMaxValue: 100,726 isIndeterminate: true,727 statusBarText: "statusBarText",728 isFloatingIcon : true,729 label: "1000",730 badgeIconStyle: 1,731 showDeliveryTime: true,732 }733 await notify.publish(notificationRequest);734 console.info("================ANS_Remove_1000 publish promise==================>");735 setTimeout((async function(){736 console.info("======ANS_Remove_1000 setTimeout============>");737 await notify.unsubscribe(subscriber);738 console.info("======ANS_Remove_1000 setTimeout unsubscribe============>");739 await notify.cancelAll();740 done();741 }),timeout);742 })743 function removeCallBack2TimesOf2(err) {744 console.info("=====ANS_Remove_1100 removeCallBack2TimesOf2 start==========>");745 console.info("=====ANS_Remove_1100 removeCallBack2TimesOf2 err============>" + JSON.stringify(err));746 expect(err.code != 0).assertEqual(true);747 console.info("=====ANS_Remove_1100 removeCallBack2TimesOf2 end==========>");748 }749 function removeCallBack2TimesOf1(err) {750 console.info("=====ANS_Remove_1100 removeCallBack2TimesOf1 start============>");751 console.info("=====ANS_Remove_1100 removeCallBack2TimesOf1 err========>" + JSON.stringify(err));752 expect(err.code).assertEqual(0);753 notify.remove(hashCode1100,removeCallBack2TimesOf2);754 console.info("=====ANS_Remove_1100 removeCallBack2TimesOf1 end============>");755 }756 var hashCode1100;757 function onConsumeCallbackRemove2Times(data) {758 console.info("=====ANS_Remove_1100 onConsume start=================>");759 console.info("=====ANS_Remove_1100 onConsume data: ================>" + JSON.stringify(data));760 hashCode1100 = data.request.hashCode;761 notify.remove(data.request.hashCode,removeCallBack2TimesOf1);762 console.info("=====ANS_Remove_1100 onConsume remove================>");763 console.info("=====ANS_Remove_1100 onConsume end===================>");764 }765 var timesOfOnCancelCallbackRemove2Times766 function onCancelCallbackRemove2Times(data) {767 timesOfOnCancelCallbackRemove2Times = timesOfOnCancelCallbackRemove2Times + 1768 console.info("=====ANS_Remove_1100 onCancel start=======================>");769 console.info("=====ANS_Remove_1100 onCancel data:=======================>" + JSON.stringify(data));770 if (timesOfOnCancelCallbackRemove2Times == 1){771 expect(data.request.id).assertEqual(11);772 } else if (timesOfOnCancelCallbackRemove2Times == 2){773 expect().assertFail();774 }775 console.info("=====ANS_Remove_1100 onCancel end=======================>");776 }777 /*778 * @tc.number: ANS_Remove_1100779 * @tc.name: remove(hashCode: string, callback: AsyncCallback<void>): void;780 * @tc.desc: Verify that the interface remove(hashCode: string, callback: AsyncCallback<void>): void;781 is called twice in a row to delete the notification information782 */783 it('ANS_Remove_1100', 0, async function (done) {784 console.info("===============ANS_Remove_1100==========================>");785 hashCode1100 = 0;786 timesOfOnCancelCallbackRemove2Times = 0787 var subscriber ={788 onConsume:onConsumeCallbackRemove2Times,789 onCancel:onCancelCallbackRemove2Times,790 }791 await notify.subscribe(subscriber);792 console.info("===============ANS_Remove_1100 subscribe promise==================>");793 var notificationRequest = {794 content:{795 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,796 normal: {797 title: "test_title",798 text: "test_text",799 additionalText: "test_additionalText"800 },801 },802 id: 11,803 slotType : notify.SlotType.OTHER_TYPES,804 isOngoing : true,805 isUnremovable : false,806 deliveryTime : 1624950453,807 tapDismissed : true,808 autoDeletedTime: 1625036817,809 color: 2,810 colorEnabled: true,811 isAlertOnce: true,812 isStopwatch: true,813 isCountDown: true,814 progressValue: 12,815 progressMaxValue: 100,816 isIndeterminate: true,817 statusBarText: "statusBarText",818 isFloatingIcon : true,819 label: "1100",820 badgeIconStyle: 1,821 showDeliveryTime: true,822 }823 await notify.publish(notificationRequest);824 console.info("==========ANS_Remove_1100 publish promise==================>");825 setTimeout((async function(){826 console.info("======ANS_Remove_1100 setTimeout============>");827 await notify.unsubscribe(subscriber);828 console.info("======ANS_Remove_1100 setTimeout unsubscribe============>");829 await notify.cancelAll();830 done();831 }),timeout);832 })833 function onConsumeCallbackRemove2TimesPromise(data) {834 console.info("================ANS_Remove_1200 onConsume start=================>");835 console.info("================ANS_Remove_1200 onConsume data:==========>" + JSON.stringify(data));836 notify.remove(data.request.hashCode);837 console.info("================ANS_Remove_1200 onConsume remove_2times1===========>");838 notify.remove(data.request.hashCode);839 console.info("================ANS_Remove_1200 onConsume remove_2times2===========>");840 console.info("================ANS_Remove_1200 onConsume end=================>");841 }842 var timesOfOnCancelCallbackRemove2TimesPromise843 function onCancelCallbackRemove2TimesPromise(data) {844 timesOfOnCancelCallbackRemove2TimesPromise = timesOfOnCancelCallbackRemove2TimesPromise + 1845 console.info("================ANS_Remove_1200 onCancel start==========>");846 console.info("================ANS_Remove_1200 onCancel data:=========>" + JSON.stringify(data));847 if (timesOfOnCancelCallbackRemove2TimesPromise == 1){848 expect(data.request.id).assertEqual(12);849 } else if (timesOfOnCancelCallbackRemove2TimesPromise == 2){850 expect().assertFail();851 }852 console.info("================ANS_Remove_1200 onCancel end==============>");853 }854 /*855 * @tc.number: ANS_Remove_1200856 * @tc.name: remove(hashCode: string): Promise<void>;857 * @tc.desc: Verify that the interface remove(hashCode: string): Promise<void> is called twice in a row to858 * delete the notification information859 */860 it('ANS_Remove_1200', 0, async function (done) {861 console.info("===============ANS_Remove_1200 start========================>");862 timesOfOnCancelCallbackRemove2TimesPromise = 0863 var subscriber ={864 onConsume:onConsumeCallbackRemove2TimesPromise,865 onCancel:onCancelCallbackRemove2TimesPromise,866 }867 await notify.subscribe(subscriber);868 console.info("===============ANS_Remove_1200 subscribe promise=============>");869 var notificationRequest = {870 content:{871 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,872 normal: {873 title: "test_title",874 text: "test_text",875 additionalText: "test_additionalText"876 },877 },878 id: 12,879 slotType : notify.SlotType.OTHER_TYPES,880 isOngoing : true,881 isUnremovable : false,882 deliveryTime : 1624950453,883 tapDismissed : true,884 autoDeletedTime: 1625036817,885 color: 2,886 colorEnabled: true,887 isAlertOnce: true,888 isStopwatch: true,889 isCountDown: true,890 progressValue: 12,891 progressMaxValue: 100,892 isIndeterminate: true,893 statusBarText: "statusBarText",894 isFloatingIcon : true,895 label: "1200",896 badgeIconStyle: 1,897 showDeliveryTime: true,898 }899 await notify.publish(notificationRequest);900 console.info("============ANS_Remove_1200 publish promise==================>");901 setTimeout((async function(){902 console.info("======ANS_Remove_1200 setTimeout============>");903 await notify.unsubscribe(subscriber);904 console.info("======ANS_Remove_1200 setTimeout unsubscribe============>");905 await notify.cancelAll();906 done();907 }),timeout);908 })909 function onConsumeRemoveIsUnremovable(data) {910 console.info("==========ANS_Remove_1300 onConsume start=================>");911 console.info("==========ANS_Remove_1300 onConsume data:=================>" + JSON.stringify(data));912 notify.remove(data.request.hashCode,removeIsUnremovableCallBack);913 console.info("==========ANS_Remove_1300 onConsume remove=============>");914 console.info("==========ANS_Remove_1300 onConsume end=================>");915 }916 function onCancelRemoveIsUnremovable(data) {917 console.info("==========ANS_Remove_1300 onCancel start================>");918 console.info("==========ANS_Remove_1300 onCancel data:===========>" + JSON.stringify(data));919 expect().assertFail();920 console.info("==========ANS_Remove_1300 onCancel end================>");921 }922 function removeIsUnremovableCallBack(err, data) {923 console.info("==========ANS_Remove_1300 removeCallBack start=======================>");924 console.info("==========ANS_Remove_1300 removeCallBack err=====================>" + JSON.stringify(err));925 expect(err.code != 0).assertEqual(true);926 console.info("==========ANS_Remove_1300 removeCallBack data=====================>" + JSON.stringify(data));927 console.info("==========ANS_Remove_1300 removeCallBack end=======================>");928 }929 /*930 * @tc.number: ANS_Remove_1300931 * @tc.name: remove(hashCode: string, callback: AsyncCallback<void>): void;932 * @tc.desc: Verify that the calling interface remove(hashCode: string, callback: AsyncCallback<void>): void;933 * deletes the notification information that the property isunremovable is true934 */935 it('ANS_Remove_1300', 0, async function (done) {936 console.info("===============ANS_Remove_1300==========================>");937 var subscriber ={938 onConsume:onConsumeRemoveIsUnremovable,939 onCancel:onCancelRemoveIsUnremovable,940 }941 await notify.subscribe(subscriber);942 console.info("================ANS_Remove_1300 subscribe promise==================>");943 var notificationRequest = {944 content:{945 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,946 normal: {947 title: "test_title",948 text: "test_text",949 additionalText: "test_additionalText"950 },951 },952 id: 13,953 slotType : notify.SlotType.OTHER_TYPES,954 isOngoing : true,955 isUnremovable : true,956 deliveryTime : 1624950453,957 tapDismissed : true,958 autoDeletedTime: 1625036817,959 color: 2,960 colorEnabled: true,961 isAlertOnce: true,962 isStopwatch: true,963 isCountDown: true,964 progressValue: 12,965 progressMaxValue: 100,966 isIndeterminate: true,967 statusBarText: "statusBarText",968 isFloatingIcon : true,969 label: "1300",970 badgeIconStyle: 1,971 showDeliveryTime: true,972 }973 await notify.publish(notificationRequest);974 console.info("================ANS_Remove_1300 publish promise==================>");975 setTimeout((async function(){976 console.info("======ANS_Remove_1300 setTimeout============>");977 await notify.unsubscribe(subscriber);978 console.info("======ANS_Remove_1300 setTimeout unsubscribe============>");979 await notify.cancelAll();980 done();981 }),timeout);982 })983 function OnConsumeRemoveIsUnremovablePromise(data) {984 console.info("==============ANS_Remove_1400 onConsume start==============>");985 console.info("==============ANS_Remove_1400 onConsume data:==============>" + JSON.stringify(data));986 notify.remove(data.request.hashCode);987 console.info("==============ANS_Remove_1400 onConsume remove=============>");988 console.info("==============ANS_Remove_1400 onConsume end================>");989 }990 function OnCancelRemoveIsUnremovablePromise(data) {991 console.info("==============ANS_Remove_1400 onCancel start==============>");992 console.info("==============ANS_Remove_1400 onCancel data:==============>" + JSON.stringify(data));993 expect().assertFail();994 console.info("==============ANS_Remove_1400 onCancel end================>");995 }996 /*997 * @tc.number: ANS_Remove_1400998 * @tc.name: remove(hashCode: string): Promise<void>;999 * @tc.desc: Verify that the calling interface remove(hashCode: string): Promise<void>;1000 deletes the notification information that the property isunremovable is true1001 */1002 it('ANS_Remove_1400', 0, async function (done) {1003 console.info("===============ANS_Remove_1400 start==========================>");1004 var subscriber ={1005 onConsume:OnConsumeRemoveIsUnremovablePromise,1006 onCancel:OnCancelRemoveIsUnremovablePromise,1007 }1008 await notify.subscribe(subscriber);1009 console.info("===============ANS_Remove_1400 subscribe promise==================>");1010 var notificationRequest = {1011 content:{1012 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1013 normal: {1014 title: "test_title",1015 text: "test_text",1016 additionalText: "test_additionalText"1017 },1018 },1019 id: 14,1020 slotType : notify.SlotType.OTHER_TYPES,1021 isOngoing : true,1022 isUnremovable : true,1023 deliveryTime : 1624950453,1024 tapDismissed : true,1025 autoDeletedTime: 1625036817,1026 color: 2,1027 colorEnabled: true,1028 isAlertOnce: true,1029 isStopwatch: true,1030 isCountDown: true,1031 progressValue: 12,1032 progressMaxValue: 100,1033 isIndeterminate: true,1034 statusBarText: "statusBarText",1035 isFloatingIcon : true,1036 label: "1400",1037 badgeIconStyle: 1,1038 showDeliveryTime: true,1039 }1040 await notify.publish(notificationRequest);1041 console.info("==============ANS_Remove_1400 publish promise==================>");1042 setTimeout((async function(){1043 console.info("======ANS_Remove_1400 setTimeout============>");1044 await notify.unsubscribe(subscriber);1045 console.info("======ANS_Remove_1400 setTimeout unsubscribe============>");1046 await notify.cancelAll();1047 done();1048 }),timeout);1049 })1050 var timesOfOnConsumeRemoveAllByBundleOption1051 function onConsumeRemoveAllByBundleOption(data) {1052 timesOfOnConsumeRemoveAllByBundleOption = timesOfOnConsumeRemoveAllByBundleOption + 11053 console.info("==========ANS_Remove_1500 onConsume start=======>");1054 console.info("==========ANS_Remove_1500 onConsume data:=======>" + JSON.stringify(data));1055 var bundleOption = {1056 bundle:data.request.creatorBundleName,1057 uid:data.request.creatorUid,1058 }1059 if (timesOfOnConsumeRemoveAllByBundleOption == 2){1060 notify.removeAll(bundleOption,removeAllByBundleOptionCallBack);1061 console.info("=======ANS_Remove_1500 onConsume remove=============>");1062 }1063 console.info("===========ANS_Remove_1500 onConsume end===========>");1064 }1065 var timesOfOnCancelRemoveAllByBundleOption1066 function onCancelRemoveAllByBundleOption(data) {1067 timesOfOnCancelRemoveAllByBundleOption = timesOfOnCancelRemoveAllByBundleOption + 11068 console.info("===========ANS_Remove_1500 onCancel start====================>");1069 console.info("===========ANS_Remove_1500 onCancel data:====================>" + JSON.stringify(data));1070 if (timesOfOnCancelRemoveAllByBundleOption == 1){1071 expect(data.request.label).assertEqual("1500_1");1072 }else if (timesOfOnCancelRemoveAllByBundleOption == 2){1073 expect(data.request.label).assertEqual("1500_2");1074 }1075 console.info("===========ANS_Remove_1500 onCancel end=======================>");1076 }1077 function removeAllByBundleOptionCallBack(data) {1078 console.info("===========ANS_Remove_1500 removeAllCallBack start=================>");1079 console.info("===========ANS_Remove_1500 removeAllCallBack data==================>" + JSON.stringify(data));1080 console.info("===========ANS_Remove_1500 removeAllCallBack end===================>");1081 }1082 /*1083 * @tc.number: ANS_Remove_15001084 * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1085 * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1086 * deletes all notification information through BundleOption1087 */1088 it('ANS_Remove_1500', 0, async function (done) {1089 console.info("===============ANS_Remove_1500 start==========================>");1090 timesOfOnCancelRemoveAllByBundleOption = 01091 timesOfOnConsumeRemoveAllByBundleOption = 01092 var subscriber ={1093 onConsume:onConsumeRemoveAllByBundleOption,1094 onCancel:onCancelRemoveAllByBundleOption,1095 }1096 await notify.subscribe(subscriber);1097 console.info("===============ANS_Remove_1500 subscribe promise==================>");1098 var notificationRequest = {1099 content:{1100 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1101 normal: {1102 title: "test_title",1103 text: "test_text",1104 additionalText: "test_additionalText"1105 },1106 },1107 id: 15,1108 slotType : notify.SlotType.OTHER_TYPES,1109 isOngoing : true,1110 isUnremovable : false,1111 deliveryTime : 1624950453,1112 tapDismissed : true,1113 autoDeletedTime: 1625036817,1114 color: 2,1115 colorEnabled: true,1116 isAlertOnce: true,1117 isStopwatch: true,1118 isCountDown: true,1119 progressValue: 12,1120 progressMaxValue: 100,1121 isIndeterminate: true,1122 statusBarText: "statusBarText",1123 isFloatingIcon : true,1124 label: "1500_1",1125 badgeIconStyle: 1,1126 showDeliveryTime: true,1127 }1128 var notificationRequest1 = {1129 content:{1130 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1131 normal: {1132 title: "test_title",1133 text: "test_text",1134 additionalText: "test_additionalText"1135 },1136 },1137 id: 15,1138 slotType : notify.SlotType.OTHER_TYPES,1139 isOngoing : true,1140 isUnremovable : false,1141 deliveryTime : 1624950453,1142 tapDismissed : true,1143 autoDeletedTime: 1625036817,1144 color: 2,1145 colorEnabled: true,1146 isAlertOnce: true,1147 isStopwatch: true,1148 isCountDown: true,1149 progressValue: 12,1150 progressMaxValue: 100,1151 isIndeterminate: true,1152 statusBarText: "statusBarText",1153 isFloatingIcon : true,1154 label: "1500_2",1155 badgeIconStyle: 1,1156 showDeliveryTime: true,1157 }1158 await notify.publish(notificationRequest);1159 console.info("=============ANS_Remove_1500 publish1 promise==================>");1160 await notify.publish(notificationRequest1);1161 console.info("=============ANS_Remove_1500 publish2 promise==================>");1162 setTimeout((async function(){1163 console.info("======ANS_Remove_1500 setTimeout============>");1164 await notify.unsubscribe(subscriber);1165 console.info("======ANS_Remove_1500 setTimeout unsubscribe============>");1166 await notify.cancelAll();1167 done();1168 }),timeout);1169 })1170 var timesOfOnConsumeRemoveAllByBundleOptionNullUid1171 function onConsumeRemoveAllByBundleOptionNullUid(data) {1172 console.info("===============ANS_Remove_1600 onConsume start================>");1173 console.info("===============ANS_Remove_1600 onConsume data:========>" + JSON.stringify(data));1174 var bundleOption = {1175 bundle:data.request.creatorBundleName,1176 uid:data.request.creatorUid,1177 }1178 timesOfOnConsumeRemoveAllByBundleOptionNullUid = timesOfOnConsumeRemoveAllByBundleOptionNullUid + 11179 if (timesOfOnConsumeRemoveAllByBundleOptionNullUid == 2){1180 notify.removeAll(bundleOption,removeAllByBundleOptionCallBackNullUid);1181 console.info("===============ANS_Remove_1600 onConsume remove==================>");1182 }1183 console.info("===============ANS_Remove_1600 onConsume end================>");1184 }1185 var timesOfOnCancelRemoveAllByBundleOptionNullUid1186 function onCancelRemoveAllByBundleOptionNullUid(data) {1187 timesOfOnCancelRemoveAllByBundleOptionNullUid = timesOfOnCancelRemoveAllByBundleOptionNullUid + 11188 console.info("===============ANS_Remove_1600 onCancel start===================>");1189 console.info("===============ANS_Remove_1600 onCancel data:===================>" + JSON.stringify(data));1190 if (timesOfOnCancelRemoveAllByBundleOptionNullUid == 1){1191 expect(data.request.label).assertEqual("1600_1");1192 }else if (timesOfOnCancelRemoveAllByBundleOptionNullUid == 2){1193 expect(data.request.label).assertEqual("1600_2");1194 }1195 console.info("===============ANS_Remove_1600 onCancel end====================>");1196 }1197 function removeAllByBundleOptionCallBackNullUid(err, data) {1198 console.info("=========ANS_Remove_1600 removeAllCallBack start=============>");1199 console.info("=========ANS_Remove_1600 removeAllCallBack err===============>" + JSON.stringify(err));1200 console.info("=========ANS_Remove_1600 removeAllCallBack data==============>" + JSON.stringify(data));1201 console.info("=========ANS_Remove_1600 removeAllCallBack end===============>");1202 }1203 /*1204 * @tc.number: ANS_Remove_16001205 * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1206 * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1207 * deletes all notification information through BundleOption Correct bundle, null uid.1208 */1209 it('ANS_Remove_1600', 0, async function (done) {1210 console.info("===============ANS_Remove_1600==========================>");1211 timesOfOnConsumeRemoveAllByBundleOptionNullUid = 01212 timesOfOnCancelRemoveAllByBundleOptionNullUid = 01213 var subscriber ={1214 onConsume:onConsumeRemoveAllByBundleOptionNullUid,1215 onCancel:onCancelRemoveAllByBundleOptionNullUid,1216 }1217 await notify.subscribe(subscriber);1218 console.info("==================ANS_Remove_1600 subscribe promise==================>");1219 var notificationRequest = {1220 content:{1221 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1222 normal: {1223 title: "test_title",1224 text: "test_text",1225 additionalText: "test_additionalText"1226 },1227 },1228 id: 16,1229 slotType : notify.SlotType.OTHER_TYPES,1230 isOngoing : true,1231 isUnremovable : false,1232 deliveryTime : 1624950453,1233 tapDismissed : true,1234 autoDeletedTime: 1625036817,1235 color: 2,1236 colorEnabled: true,1237 isAlertOnce: true,1238 isStopwatch: true,1239 isCountDown: true,1240 progressValue: 12,1241 progressMaxValue: 100,1242 isIndeterminate: true,1243 statusBarText: "statusBarText",1244 isFloatingIcon : true,1245 label: "1600_1",1246 badgeIconStyle: 1,1247 showDeliveryTime: true,1248 }1249 var notificationRequest1 = {1250 content:{1251 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1252 normal: {1253 title: "test_title",1254 text: "test_text",1255 additionalText: "test_additionalText"1256 },1257 },1258 id: 16,1259 slotType : notify.SlotType.OTHER_TYPES,1260 isOngoing : true,1261 isUnremovable : false,1262 deliveryTime : 1624950453,1263 tapDismissed : true,1264 autoDeletedTime: 1625036817,1265 color: 2,1266 colorEnabled: true,1267 isAlertOnce: true,1268 isStopwatch: true,1269 isCountDown: true,1270 progressValue: 12,1271 progressMaxValue: 100,1272 isIndeterminate: true,1273 statusBarText: "statusBarText",1274 isFloatingIcon : true,1275 label: "1600_2",1276 badgeIconStyle: 1,1277 showDeliveryTime: true,1278 }1279 await notify.publish(notificationRequest);1280 console.info("==================ANS_Remove_1600 publish1 promise==================>");1281 await notify.publish(notificationRequest1);1282 console.info("==================ANS_Remove_1600 publish2 promise==================>");1283 setTimeout((async function(){1284 console.info("======ANS_Remove_1600 setTimeout============>");1285 await notify.unsubscribe(subscriber);1286 console.info("======ANS_Remove_1600 setTimeout unsubscribe============>");1287 await notify.cancelAll();1288 done();1289 }),timeout);1290 })1291 function onConsumeRemoveAllByBundleOptionWrongUid(data) {1292 console.info("========ANS_Remove_1700 onConsume start==============>");1293 console.info("========ANS_Remove_1700 onConsume data:==============>" + JSON.stringify(data));1294 var bundleOption = {1295 bundle:data.request.creatorBundleName,1296 uid:1234567891297 }1298 notify.removeAll(bundleOption,removeAllByBundleOptionCallBackWrongUid);1299 console.info("========ANS_Remove_1700 onConsume remove============>");1300 console.info("========ANS_Remove_1700 onConsume end===============>");1301 }1302 function onCancelRemoveAllByBundleOptionWrongUid(data) {1303 console.info("==========ANS_Remove_1700 onCancel start====================>");1304 console.info("==========ANS_Remove_1700 onCancel data:====================>" + JSON.stringify(data));1305 expect().assertFail();1306 console.info("==========ANS_Remove_1700 onCancel end======================>");1307 }1308 function removeAllByBundleOptionCallBackWrongUid(err, data) {1309 console.info("==========ANS_Remove_1700 removeAllCallBack start=============>");1310 console.info("==========ANS_Remove_1700 removeAllCallBack err===============>" + JSON.stringify(err));1311 console.info("==========ANS_Remove_1700 removeAllCallBack data==============>" + JSON.stringify(data));1312 console.info("==========ANS_Remove_1700 removeAllCallBack end=======================>");1313 }1314 /*1315 * @tc.number: ANS_Remove_17001316 * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1317 * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1318 * deletes all notification information through BundleOption Correct bundle, wrong uid.1319 */1320 it('ANS_Remove_1700', 0, async function (done) {1321 console.info("===============ANS_Remove_1700==========================>");1322 var subscriber ={1323 onConsume:onConsumeRemoveAllByBundleOptionWrongUid,1324 onCancel:onCancelRemoveAllByBundleOptionWrongUid,1325 }1326 await notify.subscribe(subscriber);1327 console.info("=============ANS_Remove_1700 subscribe promise==================>");1328 var notificationRequest = {1329 content:{1330 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1331 normal: {1332 title: "test_title",1333 text: "test_text",1334 additionalText: "test_additionalText"1335 },1336 },1337 id: 17,1338 slotType : notify.SlotType.OTHER_TYPES,1339 isOngoing : true,1340 isUnremovable : false,1341 deliveryTime : 1624950453,1342 tapDismissed : true,1343 autoDeletedTime: 1625036817,1344 color: 2,1345 colorEnabled: true,1346 isAlertOnce: true,1347 isStopwatch: true,1348 isCountDown: true,1349 progressValue: 12,1350 progressMaxValue: 100,1351 isIndeterminate: true,1352 statusBarText: "statusBarText",1353 isFloatingIcon : true,1354 label: "1700",1355 badgeIconStyle: 1,1356 showDeliveryTime: true,1357 }1358 await notify.publish(notificationRequest);1359 console.info("===============ANS_Remove_1700 publish promise===============>");1360 setTimeout((async function(){1361 console.info("======ANS_Remove_1700 setTimeout============>");1362 await notify.unsubscribe(subscriber);1363 console.info("======ANS_Remove_1700 setTimeout unsubscribe============>");1364 await notify.cancelAll();1365 done();1366 }),timeout);1367 })1368 function onConsumeRemoveAllByBundleOptionWrongBundleCorrectUid(data) {1369 console.info("==============ANS_Remove_1800 onConsume start=============>");1370 console.info("==============ANS_Remove_1800 onConsume data:=============>" + JSON.stringify(data));1371 var bundleOption = {1372 bundle:"wrongBundleName",1373 uid:data.request.creatorUid,1374 }1375 notify.removeAll(bundleOption,removeAllByBundleOptionCallBackWrongBundleCorrectUid);1376 console.info("==============ANS_Remove_1800 onConsume remove=============>");1377 console.info("==============ANS_Remove_1800 onConsume end================>");1378 }1379 function onCancelremoveAllByBundleOptionwrongBundleCorrectUid(data) {1380 console.info("==============ANS_Remove_1800 onCancel start===============>");1381 console.info("==============ANS_Remove_1800 onCancel data:===============>" + JSON.stringify(data));1382 expect().assertFail();1383 console.info("==============ANS_Remove_1800 onCancel end===============>");1384 }1385 function removeAllByBundleOptionCallBackWrongBundleCorrectUid(err, data) {1386 console.info("=========ANS_Remove_1800 removeAllCallBack start==========>");1387 console.info("=========ANS_Remove_1800 removeAllCallBack err============>" + JSON.stringify(err));1388 console.info("=========ANS_Remove_1800 removeAllCallBack data===========>" + JSON.stringify(data));1389 console.info("=========ANS_Remove_1800 removeAllCallBack end==========>");1390 }1391 /*1392 * @tc.number: ANS_Remove_18001393 * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1394 * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1395 * deletes all notification information through BundleOption wrong bundle, correct uid.1396 */1397 it('ANS_Remove_1800', 0, async function (done) {1398 console.info("===============ANS_Remove_1800 start==========================>");1399 var subscriber ={1400 onConsume:onConsumeRemoveAllByBundleOptionWrongBundleCorrectUid,1401 onCancel:onCancelremoveAllByBundleOptionwrongBundleCorrectUid,1402 }1403 await notify.subscribe(subscriber);1404 console.info("================ANS_Remove_1800 subscribe promise==================>");1405 var notificationRequest = {1406 content:{1407 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1408 normal: {1409 title: "test_title",1410 text: "test_text",1411 additionalText: "test_additionalText"1412 },1413 },1414 id: 18,1415 slotType : notify.SlotType.OTHER_TYPES,1416 isOngoing : true,1417 isUnremovable : false,1418 deliveryTime : 1624950453,1419 tapDismissed : true,1420 autoDeletedTime: 1625036817,1421 color: 2,1422 colorEnabled: true,1423 isAlertOnce: true,1424 isStopwatch: true,1425 isCountDown: true,1426 progressValue: 12,1427 progressMaxValue: 100,1428 isIndeterminate: true,1429 statusBarText: "statusBarText",1430 isFloatingIcon : true,1431 label: "1800",1432 badgeIconStyle: 1,1433 showDeliveryTime: true,1434 }1435 await notify.publish(notificationRequest);1436 console.info("============ANS_Remove_1800 publish promise==================>");1437 setTimeout((async function(){1438 console.info("======ANS_Remove_1800 setTimeout============>");1439 await notify.unsubscribe(subscriber);1440 console.info("======ANS_Remove_1800 setTimeout unsubscribe============>");1441 await notify.cancelAll();1442 done();1443 }),timeout);1444 })1445 function onConsumeRemoveAllByBundleOptionNullCharacterBundleCorrectUid(data) {1446 console.info("===========ANS_Remove_1900 onConsume start===============>");1447 console.info("===========ANS_Remove_1900 onConsume data:===============>" + JSON.stringify(data));1448 var bundleOption = {1449 bundle:"",1450 uid:data.request.creatorUid,1451 }1452 notify.removeAll(bundleOption,removeAllByBundleOptionCallBackNullCharacterBundleCorrectUid);1453 console.info("===========ANS_Remove_1900 onConsume removeAll===========>");1454 console.info("===========ANS_Remove_1900 onConsume end=================>");1455 }1456 function onCancelRemoveAllByBundleOptionNullCharacterBundleCorrectUid(data) {1457 console.info("===========ANS_Remove_1900 onCancel start===========>");1458 console.info("===========ANS_Remove_1900 onCancel data:==========>" + JSON.stringify(data));1459 expect().assertFail();1460 console.info("===========ANS_Remove_1900 onCancel end===========>");1461 }1462 function removeAllByBundleOptionCallBackNullCharacterBundleCorrectUid(err, data) {1463 console.info("========ANS_Remove_1900 removeAllCallback start===========>");1464 console.info("========ANS_Remove_1900 removeAllCallback err=============>" + JSON.stringify(err));1465 console.info("========ANS_Remove_1900 removeAllCallback data=========>" + JSON.stringify(data));1466 console.info("========ANS_Remove_1900 removeAllCallback end=======================>");1467 }1468 /*1469 * @tc.number: ANS_Remove_19001470 * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1471 * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1472 * deletes all notification information through BundleOption null character bundle, correct uid.1473 */1474 it('ANS_Remove_1900', 0, async function (done) {1475 console.info("===============ANS_Remove_1900 start==========================>");1476 var subscriber ={1477 onConsume:onConsumeRemoveAllByBundleOptionNullCharacterBundleCorrectUid,1478 onCancel:onCancelRemoveAllByBundleOptionNullCharacterBundleCorrectUid,1479 }1480 await notify.subscribe(subscriber);1481 console.info("===============ANS_Remove_1900 subscribe promise==================>");1482 var notificationRequest = {1483 content:{1484 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1485 normal: {1486 title: "test_title",1487 text: "test_text",1488 additionalText: "test_additionalText"1489 },1490 },1491 id: 19,1492 slotType : notify.SlotType.OTHER_TYPES,1493 isOngoing : true,1494 isUnremovable : false,1495 deliveryTime : 1624950453,1496 tapDismissed : true,1497 autoDeletedTime: 1625036817,1498 color: 2,1499 colorEnabled: true,1500 isAlertOnce: true,1501 isStopwatch: true,1502 isCountDown: true,1503 progressValue: 12,1504 progressMaxValue: 100,1505 isIndeterminate: true,1506 statusBarText: "statusBarText",1507 isFloatingIcon : true,1508 label: "1900",1509 badgeIconStyle: 1,1510 showDeliveryTime: true,1511 }1512 await notify.publish(notificationRequest);1513 console.info("===============ANS_Remove_1900 publish promise==================>");1514 setTimeout((async function(){1515 console.info("======ANS_Remove_1900 setTimeout============>");1516 await notify.unsubscribe(subscriber);1517 console.info("======ANS_Remove_1900 setTimeout unsubscribe============>");1518 await notify.cancelAll();1519 done();1520 }),timeout);1521 })1522 function onConsumeRemoveAllByBundleOptionWrongBundleWrongUid(data) {1523 console.info("============ANS_Remove_2000 onConsume start================>");1524 console.info("============ANS_Remove_2000 onConsume data:================>" + JSON.stringify(data));1525 var bundleOption = {1526 bundle:"wrongBundleName",1527 uid:123456789,1528 }1529 notify.removeAll(bundleOption,removeAllByBundleOptionCallBackWrongBundleWrongUid);1530 console.info("============ANS_Remove_2000 onConsume remove================>");1531 console.info("============ANS_Remove_2000 onConsume end===================>");1532 }1533 function onCancelRemoveAllByBundleOptionWrongBundleWrongUid(data) {1534 console.info("============ANS_Remove_2000 onCancel start=================>");1535 console.info("============ANS_Remove_2000 onCancel data:=================>" + JSON.stringify(data));1536 expect().assertFail();1537 console.info("============ANS_Remove_2000 onCancel end==============>");1538 }1539 function removeAllByBundleOptionCallBackWrongBundleWrongUid(err, data) {1540 console.info("============ANS_Remove_2000 removeAllCallBack start============>");1541 console.info("============ANS_Remove_2000 removeAllCallBack err==============>" + JSON.stringify(err));1542 console.info("============ANS_Remove_2000 removeAllCallBack data=============>" + JSON.stringify(data));1543 console.info("============ANS_Remove_2000 removeAllCallBack end=============>");1544 }1545 /*1546 * @tc.number: ANS_Remove_20001547 * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1548 * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1549 * deletes all notification information through BundleOption wrong bundle, wrong uid.1550 */1551 it('ANS_Remove_2000', 0, async function (done) {1552 console.info("===============ANS_Remove_2000 start==========================>");1553 var subscriber ={1554 onConsume:onConsumeRemoveAllByBundleOptionWrongBundleWrongUid,1555 onCancel:onCancelRemoveAllByBundleOptionWrongBundleWrongUid,1556 }1557 await notify.subscribe(subscriber);1558 console.info("==============ANS_Remove_2000 subscribe promise==================>");1559 var notificationRequest = {1560 content:{1561 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1562 normal: {1563 title: "test_title",1564 text: "test_text",1565 additionalText: "test_additionalText"1566 },1567 },1568 id: 20,1569 slotType : notify.SlotType.OTHER_TYPES,1570 isOngoing : true,1571 isUnremovable : false,1572 deliveryTime : 1624950453,1573 tapDismissed : true,1574 autoDeletedTime: 1625036817,1575 color: 2,1576 colorEnabled: true,1577 isAlertOnce: true,1578 isStopwatch: true,1579 isCountDown: true,1580 progressValue: 12,1581 progressMaxValue: 100,1582 isIndeterminate: true,1583 statusBarText: "statusBarText",1584 isFloatingIcon : true,1585 label: "2000",1586 badgeIconStyle: 1,1587 showDeliveryTime: true,1588 }1589 await notify.publish(notificationRequest);1590 console.info("==============ANS_Remove_2000 publish promise==============>");1591 setTimeout((async function(){1592 console.info("======ANS_Remove_2000 setTimeout============>");1593 await notify.unsubscribe(subscriber);1594 console.info("======ANS_Remove_2000 setTimeout unsubscribe============>");1595 await notify.cancelAll();1596 done();1597 }),timeout);1598 })1599 function onConsumeRemoveAllByBundleOptionNullCharacterBundleWrongUid(data) {1600 console.info("=========ANS_Remove_2100 onConsume start===================>");1601 console.info("=========ANS_Remove_2100 onConsume data:======>" + JSON.stringify(data));1602 var bundleOption = {1603 bundle:"",1604 uid:123456789,1605 }1606 notify.removeAll(bundleOption,removeAllByBundleOptionCallBackNullCharacterBundleWrongUid);1607 console.info("=========ANS_Remove_2100 onConsume remove===================>");1608 console.info("=========ANS_Remove_2100 onConsume end===================>");1609 }1610 function onCancelRemoveAllByBundleOptionNullCharacterBundleWrongUid(data) {1611 console.info("=========ANS_Remove_2100 onCancel start==========>");1612 console.info("=========ANS_Remove_2100 onCancel data:==========>" + JSON.stringify(data));1613 expect().assertFail();1614 console.info("=========ANS_Remove_2100 onCancel end============>");1615 }1616 function removeAllByBundleOptionCallBackNullCharacterBundleWrongUid(err, data) {1617 console.info("=========ANS_Remove_2100 removeAllCallBack start===============>");1618 console.info("=========ANS_Remove_2100 err=========>" + JSON.stringify(err));1619 console.info("=========ANS_Remove_2100 data=========>" + JSON.stringify(data));1620 console.info("=========ANS_Remove_2100 removeAllCallBack end===============>");1621 }1622 /*1623 * @tc.number: ANS_Remove_21001624 * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1625 * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1626 * deletes all notification information through BundleOption null character bundle, wrong uid.1627 */1628 it('ANS_Remove_2100', 0, async function (done) {1629 console.info("===============ANS_Remove_2100 start==========================>");1630 var subscriber ={1631 onConsume:onConsumeRemoveAllByBundleOptionNullCharacterBundleWrongUid,1632 onCancel:onCancelRemoveAllByBundleOptionNullCharacterBundleWrongUid,1633 }1634 await notify.subscribe(subscriber);1635 console.info("============ANS_Remove_2100 subscribe promise==================>");1636 var notificationRequest = {1637 content:{1638 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1639 normal: {1640 title: "test_title",1641 text: "test_text",1642 additionalText: "test_additionalText"1643 },1644 },1645 id: 21,1646 slotType : notify.SlotType.OTHER_TYPES,1647 isOngoing : true,1648 isUnremovable : false,1649 deliveryTime : 1624950453,1650 tapDismissed : true,1651 autoDeletedTime: 1625036817,1652 color: 2,1653 colorEnabled: true,1654 isAlertOnce: true,1655 isStopwatch: true,1656 isCountDown: true,1657 progressValue: 12,1658 progressMaxValue: 100,1659 isIndeterminate: true,1660 statusBarText: "statusBarText",1661 isFloatingIcon : true,1662 label: "2100",1663 badgeIconStyle: 1,1664 showDeliveryTime: true,1665 }1666 await notify.publish(notificationRequest);1667 console.info("=========ANS_Remove_2100 publish promise==================>");1668 setTimeout((async function(){1669 console.info("======ANS_Remove_2100 setTimeout============>");1670 await notify.unsubscribe(subscriber);1671 console.info("======ANS_Remove_2100 setTimeout unsubscribe============>");1672 await notify.cancelAll();1673 done();1674 }),timeout);1675 })1676 function onConsumeRemoveAllByBundleOptionIsUnremovable(data) {1677 console.info("==========ANS_Remove_2200 onConsume start==================>");1678 console.info("==========ANS_Remove_2200 onConsume data:=================>" + JSON.stringify(data));1679 var bundleOption = {1680 bundle:data.request.creatorBundleName,1681 uid:data.request.creatorUid,1682 }1683 notify.removeAll(bundleOption,removeAllByBundleOptionCallBackIsUnremovable);1684 console.info("==========ANS_Remove_2200 onConsume removeAll==================>");1685 console.info("==========ANS_Remove_2200 onConsume end==================>");1686 }1687 function onCancelRemoveAllByBundleOptionIsUnremovable(data) {1688 console.info("==========ANS_Remove_2200 onCancel start=================>");1689 console.info("==========ANS_Remove_2200 onCancel data:=================>" + JSON.stringify(data));1690 expect().assertFail();1691 console.info("==========ANS_Remove_2200 onCancel end===================>");1692 }1693 function removeAllByBundleOptionCallBackIsUnremovable(err, data) {1694 console.info("==========ANS_Remove_2200 removeAllCallBack start==========>");1695 console.info("==========ANS_Remove_2200 removeAllCallBack err============>" + JSON.stringify(err));1696 console.info("==========ANS_Remove_2200 removeAllCallBack data===========>" + JSON.stringify(data));1697 console.info("==========ANS_Remove_2200 removeAllCallBack end============>");1698 }1699 /*1700 * @tc.number: ANS_Remove_22001701 * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void;1702 * @tc.desc: Verify that the removeAll(bundle: BundleOption, callback: AsyncCallback<void>):void1703 interface is called to delete the notification information whose attribute isUnremovable is true1704 */1705 it('ANS_Remove_2200', 0, async function (done) {1706 console.info("===============ANS_Remove_2200 start==========================>");1707 var subscriber ={1708 onConsume:onConsumeRemoveAllByBundleOptionIsUnremovable,1709 onCancel:onCancelRemoveAllByBundleOptionIsUnremovable,1710 }1711 await notify.subscribe(subscriber);1712 console.info("==============ANS_Remove_2200 subscribe promise==================>");1713 var notificationRequest = {1714 content:{1715 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1716 normal: {1717 title: "test_title",1718 text: "test_text",1719 additionalText: "test_additionalText"1720 },1721 },1722 id: 22,1723 slotType : notify.SlotType.OTHER_TYPES,1724 isOngoing : true,1725 isUnremovable : true,1726 deliveryTime : 1624950453,1727 tapDismissed : true,1728 autoDeletedTime: 1625036817,1729 color: 2,1730 colorEnabled: true,1731 isAlertOnce: true,1732 isStopwatch: true,1733 isCountDown: true,1734 progressValue: 12,1735 progressMaxValue: 100,1736 isIndeterminate: true,1737 statusBarText: "statusBarText",1738 isFloatingIcon : true,1739 label: "2200",1740 badgeIconStyle: 1,1741 showDeliveryTime: true,1742 }1743 await notify.publish(notificationRequest);1744 console.info("=============ANS_Remove_2200 publish promise==================>");1745 setTimeout((async function(){1746 console.info("======ANS_Remove_2200 setTimeout============>");1747 await notify.unsubscribe(subscriber);1748 console.info("======ANS_Remove_2200 setTimeout unsubscribe============>");1749 await notify.cancelAll();1750 done();1751 }),timeout);1752 })1753 function removeAllCallBack(err,data) {1754 console.info("================ANS_Remove_2300 removeAllCallBack start:========>");1755 console.info("================ANS_Remove_2300 removeAllCallBack err:==========>" + JSON.stringify(err));1756 console.info("================ANS_Remove_2300 removeAllCallBack data:=========>" + JSON.stringify(data));1757 console.info("================ANS_Remove_2300 removeAllCallBack end:==========>")1758 }1759 var timesOfOnConsumeRemoveAll1760 function onConsumeRemoveAll(data) {1761 timesOfOnConsumeRemoveAll = timesOfOnConsumeRemoveAll + 11762 console.info("================ANS_Remove_2300 onConsume start==================>");1763 console.info("================ANS_Remove_2300 onConsume data: =================>" + JSON.stringify(data));1764 if (timesOfOnConsumeRemoveAll == 2)1765 {1766 notify.removeAll(removeAllCallBack);1767 console.info("============ANS_Remove_2300 onConsume removeAll==========>");1768 }1769 console.info("================ANS_Remove_2300 onConsume end====================>");1770 }1771 var timesOfOnCancelRemoveAll1772 function onCancelRemoveAll(data) {1773 timesOfOnCancelRemoveAll = timesOfOnCancelRemoveAll + 11774 console.info("==================ANS_Remove_2300 onCancel start===========>");1775 console.info("==================ANS_Remove_2300 onCancel data============>" + JSON.stringify(data));1776 if (timesOfOnCancelRemoveAll == 1)1777 {1778 expect(data.request.label).assertEqual("2300_1");1779 }1780 if (timesOfOnCancelRemoveAll == 2)1781 {1782 expect(data.request.label).assertEqual("2300_2");1783 }1784 console.info("==================ANS_Remove_2300 onCancel end=============>");1785 }1786 /*1787 * @tc.number: ANS_Remove_23001788 * @tc.name: removeAll(callback: AsyncCallback<void>): void;1789 * @tc.desc: Verify that the removeAll(callback: AsyncCallback<void>): void interface is called to delete the1790 * notification information1791 */1792 it('ANS_Remove_2300', 0, async function (done) {1793 console.info("===============ANS_Remove_2300 start==========================>");1794 timesOfOnConsumeRemoveAll = 0;1795 timesOfOnCancelRemoveAll = 0;1796 var subscriber ={1797 onConsume:onConsumeRemoveAll,1798 onCancel:onCancelRemoveAll,1799 }1800 await notify.subscribe(subscriber);1801 console.info("=============ANS_Remove_2300 subscribe promise==================>");1802 var notificationRequest = {1803 content:{1804 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1805 normal: {1806 title: "test_title",1807 text: "test_text",1808 additionalText: "test_additionalText"1809 },1810 },1811 id: 23,1812 slotType : notify.SlotType.OTHER_TYPES,1813 isOngoing : true,1814 isUnremovable : false,1815 deliveryTime : 1624950453,1816 tapDismissed : true,1817 autoDeletedTime: 1625036817,1818 color: 2,1819 colorEnabled: true,1820 isAlertOnce: true,1821 isStopwatch: true,1822 isCountDown: true,1823 progressValue: 12,1824 progressMaxValue: 100,1825 isIndeterminate: true,1826 statusBarText: "statusBarText",1827 isFloatingIcon : true,1828 label: "2300_1",1829 badgeIconStyle: 1,1830 showDeliveryTime: true,1831 }1832 var notificationRequest1 = {1833 content:{1834 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1835 normal: {1836 title: "test_title",1837 text: "test_text",1838 additionalText: "test_additionalText"1839 },1840 },1841 id: 23,1842 slotType : notify.SlotType.OTHER_TYPES,1843 isOngoing : true,1844 isUnremovable : false,1845 deliveryTime : 1624950453,1846 tapDismissed : true,1847 autoDeletedTime: 1625036817,1848 color: 2,1849 colorEnabled: true,1850 isAlertOnce: true,1851 isStopwatch: true,1852 isCountDown: true,1853 progressValue: 12,1854 progressMaxValue: 100,1855 isIndeterminate: true,1856 statusBarText: "statusBarText",1857 isFloatingIcon : true,1858 label: "2300_2",1859 badgeIconStyle: 1,1860 showDeliveryTime: true,1861 }1862 await notify.publish(notificationRequest);1863 console.info("===========ANS_Remove_2300 publish1 promise================>");1864 await notify.publish(notificationRequest1);1865 console.info("============ANS_Remove_2300 publish2 promise===============>");1866 setTimeout((async function(){1867 console.info("======ANS_Remove_2300 setTimeout============>");1868 await notify.unsubscribe(subscriber);1869 console.info("======ANS_Remove_2300 setTimeout unsubscribe============>");1870 await notify.cancelAll();1871 done();1872 }),timeout);1873 })1874 var timesOfOnConsumeRemoveAll1875 function onConsumeRemoveAllPromise(data) {1876 timesOfOnConsumeRemoveAll = timesOfOnConsumeRemoveAll + 11877 console.info("===========ANS_Remove_2400 onConsume start==============>");1878 console.info("===========ANS_Remove_2400 onConsume data:==============>" + JSON.stringify(data));1879 if (timesOfOnConsumeRemoveAll == 2)1880 {1881 notify.removeAll();1882 console.info("===========ANS_Remove_2400 onConsume removeAll==========>");1883 }1884 console.info("===========ANS_Remove_2400 onConsume end==============>");1885 }1886 var timesOfOnCancelRemoveAll1887 function onCancelRemoveAllPromise(data) {1888 timesOfOnCancelRemoveAll = timesOfOnCancelRemoveAll + 11889 console.info("===========ANS_Remove_2400 onCancel start=======================>");1890 console.info("===========ANS_Remove_2400 onCancel data : =============>" + JSON.stringify(data));1891 if (timesOfOnCancelRemoveAll == 1)1892 {1893 expect(data.request.label).assertEqual("2400_1");1894 }1895 if (timesOfOnCancelRemoveAll == 2)1896 {1897 expect(data.request.label).assertEqual("2400_2");1898 }1899 console.info("===========ANS_Remove_2400 onCancel end=======================>");1900 }1901 /*1902 * @tc.number: ANS_Remove_24001903 * @tc.name: removeAll(bundle?: BundleOption): Promise<void>1904 * @tc.desc: Verify that the removeAll(bundle?: BundleOption): Promise<void> interface is called to delete the1905 * notification information1906 */1907 it('ANS_Remove_2400', 0, async function (done) {1908 console.info("===============ANS_Remove_2400 start==========================>");1909 timesOfOnConsumeRemoveAll = 01910 timesOfOnCancelRemoveAll = 01911 var subscriber ={1912 onConsume:onConsumeRemoveAllPromise,1913 onCancel:onCancelRemoveAllPromise,1914 }1915 await notify.subscribe(subscriber);1916 console.info("==============ANS_Remove_2400 subscribe promise==================>");1917 var notificationRequest = {1918 content:{1919 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1920 normal: {1921 title: "test_title",1922 text: "test_text",1923 additionalText: "test_additionalText"1924 },1925 },1926 id: 24,1927 slotType : notify.SlotType.OTHER_TYPES,1928 isOngoing : true,1929 isUnremovable : false,1930 deliveryTime : 1624950453,1931 tapDismissed : true,1932 autoDeletedTime: 1625036817,1933 color: 2,1934 colorEnabled: true,1935 isAlertOnce: true,1936 isStopwatch: true,1937 isCountDown: true,1938 progressValue: 12,1939 progressMaxValue: 100,1940 isIndeterminate: true,1941 statusBarText: "statusBarText",1942 isFloatingIcon : true,1943 label: "2400_1",1944 badgeIconStyle: 1,1945 showDeliveryTime: true,1946 }1947 var notificationRequest1 = {1948 content:{1949 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,1950 normal: {1951 title: "test_title",1952 text: "test_text",1953 additionalText: "test_additionalText"1954 },1955 },1956 id: 24,1957 slotType : notify.SlotType.OTHER_TYPES,1958 isOngoing : true,1959 isUnremovable : false,1960 deliveryTime : 1624950453,1961 tapDismissed : true,1962 autoDeletedTime: 1625036817,1963 color: 2,1964 colorEnabled: true,1965 isAlertOnce: true,1966 isStopwatch: true,1967 isCountDown: true,1968 progressValue: 12,1969 progressMaxValue: 100,1970 isIndeterminate: true,1971 statusBarText: "statusBarText",1972 isFloatingIcon : true,1973 label: "2400_2",1974 badgeIconStyle: 1,1975 showDeliveryTime: true,1976 }1977 await notify.publish(notificationRequest);1978 console.info("===ANS_Remove_2400 publish1 promise============>");1979 await notify.publish(notificationRequest1);1980 console.info("===ANS_Remove_2400 publish2 promise============>");1981 setTimeout((async function(){1982 console.info("======ANS_Remove_2400 setTimeout============>");1983 await notify.unsubscribe(subscriber);1984 console.info("======ANS_Remove_2400 setTimeout unsubscribe============>");1985 await notify.cancelAll();1986 done();1987 }),timeout);1988 })1989 function removeAllCallBackIsUnremovable(err,data) {1990 console.info("=========ANS_Remove_2500 removeAllCallBack start=========>");1991 console.info("=========ANS_Remove_2500 removeAllCallBack err:==========>" + JSON.stringify(err));1992 console.info("=========ANS_Remove_2500 removeAllCallBack data:=========>" + JSON.stringify(data));1993 console.info("=========ANS_Remove_2500 removeAllCallBack end===========>");1994 }1995 function onConsumeRemoveAllIsUnremovable(data) {1996 console.info("=========ANS_Remove_2500 onConsume start===========>");1997 console.info("=========ANS_Remove_2500 onConsumedata:============>" + JSON.stringify(data));1998 notify.removeAll(removeAllCallBackIsUnremovable);1999 console.info("=========ANS_Remove_2500 onConsume removeAll=======>");2000 console.info("=========ANS_Remove_2500 onConsume end=============>");2001 }2002 function onCancelCallbackRemoveAllIsUnremovable(data) {2003 console.info("=========ANS_Remove_2500 onCancel start==============>");2004 console.info("=========ANS_Remove_2500 onCancel data:==============>" + JSON.stringify(data));2005 console.info("=========ANS_Remove_2500 onCancel end================>");2006 }2007 /*2008 * @tc.number: ANS_Remove_25002009 * @tc.name: removeAll(callback: AsyncCallback<void>): void;2010 * @tc.desc: Verify that the removeAll(callback: AsyncCallback<void>): void interface is called to delete the2011 * notification information whose attribute isUnremovable is true2012 */2013 it('ANS_Remove_2500', 0, async function (done) {2014 console.info("===============ANS_Remove_2500 start==========================>");2015 var subscriber ={2016 onConsume:onConsumeRemoveAllIsUnremovable,2017 onCancel:onCancelCallbackRemoveAllIsUnremovable,2018 }2019 await notify.subscribe(subscriber);2020 console.info("======ANS_Remove_2500 subscribe promise==================>");2021 var notificationRequest = {2022 content:{2023 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,2024 normal: {2025 title: "test_title",2026 text: "test_text",2027 additionalText: "test_additionalText"2028 },2029 },2030 id: 25,2031 slotType : notify.SlotType.OTHER_TYPES,2032 isOngoing : true,2033 isUnremovable : true,2034 deliveryTime : 1624950453,2035 tapDismissed : true,2036 autoDeletedTime: 1625036817,2037 color: 2,2038 colorEnabled: true,2039 isAlertOnce: true,2040 isStopwatch: true,2041 isCountDown: true,2042 progressValue: 12,2043 progressMaxValue: 100,2044 isIndeterminate: true,2045 statusBarText: "statusBarText",2046 isFloatingIcon : true,2047 label: "2500",2048 badgeIconStyle: 1,2049 showDeliveryTime: true,2050 }2051 await notify.publish(notificationRequest);2052 console.info("============ANS_Remove_2500 publish promise==================>");2053 setTimeout((async function(){2054 console.info("======ANS_Remove_2500 setTimeout============>");2055 await notify.unsubscribe(subscriber);2056 console.info("======ANS_Remove_2500 setTimeout unsubscribe============>");2057 await notify.cancelAll();2058 done();2059 }),timeout);2060 })2061 function OnConsumeRemoveAllIsUnremovablePromise(data) {2062 console.info("===========ANS_Remove_2600 onConsume start===========>");2063 console.info("===========ANS_Remove_2600 onConsume data============>" + JSON.stringify(data));2064 notify.removeAll()2065 console.info("===========ANS_Remove_2600 onConsume removeAll=======>");2066 console.info("===========ANS_Remove_2600 onConsume end=============>");2067 }2068 function OnCancelCallbackRemoveAllIsUnremovablePromise(data) {2069 console.info("===========ANS_Remove_2600 onCancel start================>");2070 console.info("===========ANS_Remove_2600 onCancel data : ==============>" + JSON.stringify(data));2071 console.info("===========ANS_Remove_2600 onCancel end==================>");2072 }2073 /*2074 * @tc.number: ANS_Remove_26002075 * @tc.name: removeAll(bundle?: BundleOption): Promise<void>;2076 * @tc.desc: Verify that the removeAll(bundle?: BundleOption): Promise<void> interface is called to delete the2077 * notification information whose attribute isUnremovable is true2078 */2079 it('ANS_Remove_2600', 0, async function (done) {2080 console.info("===============ANS_Remove_2600 start==========================>");2081 var subscriber ={2082 onConsume:OnConsumeRemoveAllIsUnremovablePromise,2083 onCancel:OnCancelCallbackRemoveAllIsUnremovablePromise,2084 }2085 await notify.subscribe(subscriber);2086 console.info("============ANS_Remove_2600 subscribe promise==================>");2087 var notificationRequest = {2088 content:{2089 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,2090 normal: {2091 title: "test_title",2092 text: "test_text",2093 additionalText: "test_additionalText"2094 },2095 },2096 id: 26,2097 slotType : notify.SlotType.OTHER_TYPES,2098 isOngoing : true,2099 isUnremovable : true,2100 deliveryTime : 1624950453,2101 tapDismissed : true,2102 autoDeletedTime: 1625036817,2103 color: 2,2104 colorEnabled: true,2105 isAlertOnce: true,2106 isStopwatch: true,2107 isCountDown: true,2108 progressValue: 12,2109 progressMaxValue: 100,2110 isIndeterminate: true,2111 statusBarText: "statusBarText",2112 isFloatingIcon : true,2113 label: "2600",2114 badgeIconStyle: 1,2115 showDeliveryTime: true,2116 }2117 await notify.publish(notificationRequest);2118 console.info("==========ANS_Remove_2600 publish promise==============>");2119 setTimeout((async function(){2120 console.info("======ANS_Remove_2600 setTimeout============>");2121 await notify.unsubscribe(subscriber);2122 console.info("======ANS_Remove_2600 setTimeout unsubscribe============>");2123 await notify.cancelAll();2124 done();2125 }),timeout);2126 })2127 function removeAllCallBack2TimesOf2(err,data) {2128 console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf2 start===========>");2129 console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf2 err=============>" + JSON.stringify(err));2130 console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf2 data============>" + JSON.stringify(data));2131 console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf2 end=============>");2132 }2133 function removeAllCallBack2TimesOf1(err,data) {2134 console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf1 start==========>");2135 console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf1 err============>" + JSON.stringify(err));2136 console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf1 data===========>" + JSON.stringify(data));2137 expect(err.code).assertEqual(0);2138 notify.removeAll(removeAllCallBack2TimesOf2);2139 console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf1 removeAll=====>");2140 console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf1 end==========>");2141 }2142 function onConsumeRemoveAll2Times(data) {2143 console.info("=======ANS_Remove_2700 onConsume start=========>");2144 console.info("=======ANS_Remove_2700 onConsume data:=========>" + JSON.stringify(data));2145 notify.removeAll(removeAllCallBack2TimesOf1);2146 console.info("=======ANS_Remove_2700 onConsume remove========>");2147 console.info("=======ANS_Remove_2700 onConsume end===========>");2148 }2149 var timesOfOnCancelCallbackRemoveAll2Times2150 function onCancelRemoveAll2Times(data) {2151 timesOfOnCancelCallbackRemoveAll2Times = timesOfOnCancelCallbackRemoveAll2Times + 12152 console.info("=======ANS_Remove_2700 onCancel start============>");2153 console.info("=======ANS_Remove_2700 onCancel data:============>" + JSON.stringify(data));2154 if (timesOfOnCancelCallbackRemoveAll2Times == 1){2155 expect(data.request.id).assertEqual(27);2156 } else if (timesOfOnCancelCallbackRemoveAll2Times == 2){2157 expect().assertFail();2158 }2159 console.info("=======ANS_Remove_2700 onCancel end============>");2160 }2161 /*2162 * @tc.number: ANS_Remove_27002163 * @tc.name: remove(hashCode: string, callback: AsyncCallback<void>): void;2164 * @tc.desc: Verify that the interface remove(hashCode: string, callback: AsyncCallback<void>): void; is called2165 * twice in a row to delete the notification information2166 */2167 it('ANS_Remove_2700', 0, async function (done) {2168 console.info("===============ANS_Remove_2700 start==========================>");2169 timesOfOnCancelCallbackRemoveAll2Times = 02170 var subscriber ={2171 onConsume:onConsumeRemoveAll2Times,2172 onCancel:onCancelRemoveAll2Times,2173 }2174 await notify.subscribe(subscriber);2175 console.info("============ANS_Remove_2700 subscribe promise==================>");2176 var notificationRequest = {2177 content:{2178 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,2179 normal: {2180 title: "test_title",2181 text: "test_text",2182 additionalText: "test_additionalText"2183 },2184 },2185 id: 27,2186 slotType : notify.SlotType.OTHER_TYPES,2187 isOngoing : true,2188 isUnremovable : false,2189 deliveryTime : 1624950453,2190 tapDismissed : true,2191 autoDeletedTime: 1625036817,2192 color: 2,2193 colorEnabled: true,2194 isAlertOnce: true,2195 isStopwatch: true,2196 isCountDown: true,2197 progressValue: 12,2198 progressMaxValue: 100,2199 isIndeterminate: true,2200 statusBarText: "statusBarText",2201 isFloatingIcon : true,2202 label: "2700",2203 badgeIconStyle: 1,2204 showDeliveryTime: true,2205 }2206 await notify.publish(notificationRequest);2207 console.info("=========ANS_Remove_2700 publish promise==================>");2208 setTimeout((async function(){2209 console.info("======ANS_Remove_2700 setTimeout============>");2210 await notify.unsubscribe(subscriber);2211 console.info("======ANS_Remove_2700 setTimeout unsubscribe============>");2212 await notify.cancelAll();2213 done();2214 }),timeout);2215 })2216 function onConsumeCallbackRemoveAll2TimesPromise(data) {2217 console.info("=============ANS_Remove_2800 onConsume start=============>");2218 console.info("=============ANS_Remove_2800 onConsume data: =======================>" + JSON.stringify(data));2219 notify.removeAll()2220 console.info("=============ANS_Remove_2800 onConsume removeAll1=======================>");2221 notify.removeAll()2222 console.info("=============ANS_Remove_2800 onConsume removeAll2=======================>");2223 console.info("=============ANS_Remove_2800 onConsume end=============>");2224 }2225 var timesOfOnCancelCallbackRemoveAll2TimesPromise2226 function onCancelCallbackRemoveAll2TimesPromise(data) {2227 timesOfOnCancelCallbackRemoveAll2TimesPromise = timesOfOnCancelCallbackRemoveAll2TimesPromise + 12228 console.info("===================ANS_Remove_2800 onCancel start=======================>");2229 console.info("===================ANS_Remove_2800 onCancel data : ========>" + JSON.stringify(data));2230 if (timesOfOnCancelCallbackRemoveAll2TimesPromise == 1){2231 expect(data.request.id).assertEqual(28);2232 } else if (timesOfOnCancelCallbackRemoveAll2TimesPromise == 2){2233 expect().assertFail();2234 }2235 console.info("===================ANS_Remove_2800 onCancel end=======================>");2236 }2237 /*2238 * @tc.number: ANS_Remove_28002239 * @tc.name: removeAll(bundle?: BundleOption): Promise<void>;2240 * @tc.desc: Verify that the interface removeAll(bundle?: BundleOption): Promise<void>; is called twice in a row2241 * to delete the notification information2242 */2243 it('ANS_Remove_2800', 0, async function (done) {2244 console.info("===============ANS_Remove_2800 start==========================>");2245 timesOfOnCancelCallbackRemoveAll2TimesPromise = 02246 var subscriber ={2247 onConsume:onConsumeCallbackRemoveAll2TimesPromise,2248 onCancel:onCancelCallbackRemoveAll2TimesPromise,2249 }2250 await notify.subscribe(subscriber);2251 console.info("================ANS_Remove_2800 subscribe promise==================>");2252 var notificationRequest = {2253 content:{2254 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,2255 normal: {2256 title: "test_title",2257 text: "test_text",2258 additionalText: "test_additionalText"2259 },2260 },2261 id: 28,2262 slotType : notify.SlotType.OTHER_TYPES,2263 isOngoing : true,2264 isUnremovable : false,2265 deliveryTime : 1624950453,2266 tapDismissed : true,2267 autoDeletedTime: 1625036817,2268 color: 2,2269 colorEnabled: true,2270 isAlertOnce: true,2271 isStopwatch: true,2272 isCountDown: true,2273 progressValue: 12,2274 progressMaxValue: 100,2275 isIndeterminate: true,2276 statusBarText: "statusBarText",2277 isFloatingIcon : true,2278 label: "2800",2279 badgeIconStyle: 1,2280 showDeliveryTime: true,2281 }2282 await notify.publish(notificationRequest);2283 console.info("================ANS_Remove_2800 publish promise==================>");2284 setTimeout((async function(){2285 console.info("======ANS_Remove_2800 setTimeout============>");2286 await notify.unsubscribe(subscriber);2287 console.info("======ANS_Remove_2800 setTimeout unsubscribe============>");2288 await notify.cancelAll();2289 done();2290 }),timeout);2291 })2292 function onConsumeRemoveByNotificationKey(data) {2293 console.info("=======ANS_Remove_2900 onConsume start=======================>");2294 console.info("=======ANS_Remove_2900 onConsume data: =======================>" + JSON.stringify(data));2295 console.info("=======ANS_Remove_2900 onConsume creatorBundleName:====>" + data.request.creatorBundleName);2296 console.info("=======ANS_Remove_2900 onConsume creatorUid:==============>" + data.request.creatorUid);2297 console.info("=======ANS_Remove_2900 onConsume id: =======================>" + data.request.id);2298 console.info("=======ANS_Remove_2900 onConsume label: =======================>" + data.request.label);2299 var bundleOption = {2300 bundle:data.request.creatorBundleName,2301 uid:data.request.creatorUid,2302 }2303 var notificationKey = {2304 id:data.request.id,2305 label:data.request.label2306 }2307 notify.remove(bundleOption,notificationKey,removeByNotificationKeyCB);2308 console.info("=============ANS_Remove_2900 onConsume remove=======================>");2309 console.info("=============ANS_Remove_2900 onConsume end=======================>");2310 }2311 function onCancelRemoveByNotificationKey(data) {2312 console.info("=============ANS_Remove_2900 onCancel start================>");2313 console.info("=============ANS_Remove_2900 onCancel data:==========>" + JSON.stringify(data));2314 expect(data.request.label).assertEqual("2900");2315 console.info("=============ANS_Remove_2900 onCancel label:==========>" + JSON.stringify(data.request.label));2316 expect(data.request.id).assertEqual(29);2317 console.info("=============ANS_Remove_2900 onCancel id:==========>" + JSON.stringify(data.request.id));2318 console.info("=============ANS_Remove_2900 onCancel end================>");2319 }2320 function removeByNotificationKeyCB(err, data) {2321 console.info("==========ANS_Remove_2900 removeCalback start============>");2322 console.info("==========ANS_Remove_2900 removeCalback err==============>" + JSON.stringify(err));2323 console.info("==========ANS_Remove_2900 removeCalback data=============>" + JSON.stringify(data));2324 console.info("==========ANS_Remove_2900 removeCalback end============>");2325 }2326 /*2327 * @tc.number: ANS_Remove_29002328 * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback<void>): void;2329 * @tc.desc: Verify that the calling interface remove(bundle: BundleOption, notificationKey: NotificationKey,2330 * callback: AsyncCallback<void>): void; deletes notification information through BundleOption and2331 * NotificationKey2332 */2333 it('ANS_Remove_2900', 0, async function (done) {2334 console.info("===============ANS_Remove_2900 start==========================>");2335 var subscriber ={2336 onConsume:onConsumeRemoveByNotificationKey,2337 onCancel:onCancelRemoveByNotificationKey,2338 }2339 await notify.subscribe(subscriber);2340 console.info("================ANS_Remove_2900 subscribe promise==================>");2341 var notificationRequest = {2342 content:{2343 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,2344 normal: {2345 title: "test_title",2346 text: "test_text",2347 additionalText: "test_additionalText"2348 },2349 },2350 id: 29,2351 slotType : notify.SlotType.OTHER_TYPES,2352 isOngoing : true,2353 isUnremovable : false,2354 deliveryTime : 1624950453,2355 tapDismissed : true,2356 autoDeletedTime: 1625036817,2357 color: 2,2358 colorEnabled: true,2359 isAlertOnce: true,2360 isStopwatch: true,2361 isCountDown: true,2362 progressValue: 12,2363 progressMaxValue: 100,2364 isIndeterminate: true,2365 statusBarText: "statusBarText",2366 isFloatingIcon : true,2367 label: "2900",2368 badgeIconStyle: 1,2369 showDeliveryTime: true,2370 }2371 await notify.publish(notificationRequest);2372 console.info("==============ANS_Remove_2900 publish promise==================>");2373 setTimeout((async function(){2374 console.info("======ANS_Remove_2900 setTimeout============>");2375 await notify.unsubscribe(subscriber);2376 console.info("======ANS_Remove_2900 setTimeout unsubscribe============>");2377 await notify.cancelAll();2378 done();2379 }),timeout);2380 })2381 function onConsumeRemoveByNotificationKeyPromise(data) {2382 console.info("==========ANS_Remove_3000 onConsume start==============>");2383 console.info("==========ANS_Remove_3000 data: =======================>" + JSON.stringify(data));2384 var bundleOption = {2385 bundle:data.request.creatorBundleName,2386 uid:data.request.creatorUid,2387 }2388 var notificationKey = {2389 id:30,2390 label:"3000"2391 }2392 notify.remove(bundleOption,notificationKey)2393 console.info("==========ANS_Remove_3000 onConsume remove==============>");2394 console.info("==========ANS_Remove_3000 onConsume end=================>");2395 }2396 function onCancelRemoveByNotificationKeyPromise(data) {2397 console.info("========ANS_Remove_3000 onCancel start========>");2398 console.info("========ANS_Remove_3000 onCancel data:========>" + JSON.stringify(data));2399 expect(data.request.label).assertEqual("3000");2400 expect(data.request.id).assertEqual(30);2401 console.info("========ANS_Remove_3000 onCancel end==========>");2402 }2403 /*2404 * @tc.number: ANS_Remove_30002405 * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey): Promise<void>;2406 * @tc.desc: Verify that the calling interface2407 remove(bundle: BundleOption, notificationKey: NotificationKey): Promise<void>2408 deletes notification information through BundleOption and NotificationKey2409 */2410 it('ANS_Remove_3000', 0, async function (done) {2411 console.info("===============ANS_Remove_3000 start==========================>");2412 var subscriber ={2413 onConsume:onConsumeRemoveByNotificationKeyPromise,2414 onCancel:onCancelRemoveByNotificationKeyPromise,2415 }2416 await notify.subscribe(subscriber);2417 console.info("===============ANS_Remove_3000 subscribe promise==================>");2418 var notificationRequest = {2419 content:{2420 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,2421 normal: {2422 title: "test_title",2423 text: "test_text",2424 additionalText: "test_additionalText"2425 },2426 },2427 id: 30,2428 slotType : notify.SlotType.OTHER_TYPES,2429 isOngoing : true,2430 isUnremovable : false,2431 deliveryTime : 1624950453,2432 tapDismissed : true,2433 autoDeletedTime: 1625036817,2434 color: 2,2435 colorEnabled: true,2436 isAlertOnce: true,2437 isStopwatch: true,2438 isCountDown: true,2439 progressValue: 12,2440 progressMaxValue: 100,2441 isIndeterminate: true,2442 statusBarText: "statusBarText",2443 isFloatingIcon : true,2444 label: "3000",2445 badgeIconStyle: 1,2446 showDeliveryTime: true,2447 }2448 await notify.publish(notificationRequest);2449 console.info("=============ANS_Remove_3000 publish promise==================>");2450 setTimeout((async function(){2451 console.info("======ANS_Remove_3000 setTimeout============>");2452 await notify.unsubscribe(subscriber);2453 console.info("======ANS_Remove_3000 setTimeout unsubscribe============>");2454 await notify.cancelAll();2455 done();2456 }),timeout);2457 })2458 function onConsumeRemoveByNotificationKeyWrongKey(data) {2459 console.info("==========ANS_Remove_3100 onConsume start=============>");2460 console.info("==========ANS_Remove_3100 onConsume data:=============>" + JSON.stringify(data));2461 var bundleOption = {2462 bundle:data.request.creatorBundleName,2463 uid:data.request.creatorUid,2464 }2465 var notificationKey = {2466 id:0,2467 label:"wrongLabel"2468 }2469 notify.remove(bundleOption,notificationKey,removeByNotificationKeyCBWrongKey);2470 console.info("==========ANS_Remove_3100 onConsume remove==========>");2471 console.info("==========ANS_Remove_3100 onConsume end=============>");2472 }2473 function onCancelRemoveByNotificationKeyWrongKey(data) {2474 console.info("==========ANS_Remove_3100 onCancel start===========>");2475 console.info("==========ANS_Remove_3100 onCancel data:===========>" + JSON.stringify(data));2476 expect().assertFail();2477 console.info("==========ANS_Remove_3100 onCancel end===========>");2478}2479 function removeByNotificationKeyCBWrongKey(err, data) {2480 console.info("==========ANS_Remove_3100 removeCallback start===========>");2481 console.info("==========ANS_Remove_3100 removeCallback err=============>" + JSON.stringify(err));2482 expect(err.code != 0).assertEqual(true);2483 console.info("==========ANS_Remove_3100 removeCallback data============>" + JSON.stringify(data));2484 console.info("==========ANS_Remove_3100 removeCallback end===========>");2485 }2486 /*2487 * @tc.number: ANS_Remove_31002488 * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback<void>): void;2489 * @tc.desc: Verify that the calling interface remove(bundle: BundleOption, notificationKey: NotificationKey,2490 * callback: AsyncCallback<void>): void; deletes notification information through BundleOption and2491 * NotificationKey correct bundleOption,wrong notificationKey.2492 */2493 it('ANS_Remove_3100', 0, async function (done) {2494 console.info("===============ANS_Remove_3100 start==========================>");2495 var subscriber ={2496 onConsume:onConsumeRemoveByNotificationKeyWrongKey,2497 onCancel:onCancelRemoveByNotificationKeyWrongKey,2498 }2499 await notify.subscribe(subscriber);2500 console.info("==============ANS_Remove_3100 subscribe promise==================>");2501 var notificationRequest = {2502 content:{2503 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,2504 normal: {2505 title: "test_title",2506 text: "test_text",2507 additionalText: "test_additionalText"2508 },2509 },2510 id: 31,2511 slotType : notify.SlotType.OTHER_TYPES,2512 isOngoing : true,2513 isUnremovable : false,2514 deliveryTime : 1624950453,2515 tapDismissed : true,2516 autoDeletedTime: 1625036817,2517 color: 2,2518 colorEnabled: true,2519 isAlertOnce: true,2520 isStopwatch: true,2521 isCountDown: true,2522 progressValue: 12,2523 progressMaxValue: 100,2524 isIndeterminate: true,2525 statusBarText: "statusBarText",2526 isFloatingIcon : true,2527 label: "3100",2528 badgeIconStyle: 1,2529 showDeliveryTime: true,2530 }2531 await notify.publish(notificationRequest);2532 console.info("=============ANS_Remove_3100 publish promise==================>");2533 setTimeout((async function(){2534 console.info("======ANS_Remove_3100 setTimeout============>");2535 await notify.unsubscribe(subscriber);2536 console.info("======ANS_Remove_3100 setTimeout unsubscribe============>");2537 await notify.cancelAll();2538 done();2539 }),timeout);2540 })2541 function onConsumeRemoveByNotificationKeyWrongKeyPromise(data) {2542 console.info("===========ANS_Remove_3200 onConsume start===============>");2543 console.info("===========ANS_Remove_3200 onConsume data:===============>" + JSON.stringify(data));2544 var bundleOption = {2545 bundle:data.request.creatorBundleName,2546 uid:data.request.creatorUid,2547 }2548 var notificationKey = {2549 id:0,2550 label:"wrongLabel"2551 }2552 notify.remove(bundleOption, notificationKey);2553 console.info("===========ANS_Remove_3200 onConsume remove============>");2554 console.info("===========ANS_Remove_3200 onConsume end===============>");2555 }2556 function onCancelRemoveByNotificationKeyWrongKeyPromise(data) {2557 console.info("===========ANS_Remove_3200 onCancel start=================>");2558 console.info("===========ANS_Remove_3200 onCanceldata:==================>" + JSON.stringify(data));2559 expect().assertFail();2560 console.info("===========ANS_Remove_3200 onCancel end=================>");2561 }2562 /*2563 * @tc.number: ANS_Remove_32002564 * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback<void>): void;2565 * @tc.desc: Verify that the calling interface remove(bundle: BundleOption, notificationKey: NotificationKey):2566 * Promise<void> deletes notification information through BundleOption and NotificationKey correct2567 * bundleOption,wrong notificationKey.2568 */2569 it('ANS_Remove_3200', 0, async function (done) {2570 console.info("===============ANS_Remove_3200 start=================>");2571 var subscriber ={2572 onConsume:onConsumeRemoveByNotificationKeyWrongKeyPromise,2573 onCancel:onCancelRemoveByNotificationKeyWrongKeyPromise,2574 }2575 await notify.subscribe(subscriber);2576 console.info("===============ANS_Remove_3200 subscribe promise==================>");2577 var notificationRequest = {2578 content:{2579 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,2580 normal: {2581 title: "test_title",2582 text: "test_text",2583 additionalText: "test_additionalText"2584 },2585 },2586 id: 32,2587 slotType : notify.SlotType.OTHER_TYPES,2588 isOngoing : true,2589 isUnremovable : false,2590 deliveryTime : 1624950453,2591 tapDismissed : true,2592 autoDeletedTime: 1625036817,2593 color: 2,2594 colorEnabled: true,2595 isAlertOnce: true,2596 isStopwatch: true,2597 isCountDown: true,2598 progressValue: 12,2599 progressMaxValue: 100,2600 isIndeterminate: true,2601 statusBarText: "statusBarText",2602 isFloatingIcon : true,2603 label: "3200",2604 badgeIconStyle: 1,2605 showDeliveryTime: true,2606 }2607 await notify.publish(notificationRequest);2608 console.info("===========ANS_Remove_3200 publish promise==================>");2609 setTimeout((async function(){2610 console.info("======ANS_Remove_3200 setTimeout============>");2611 await notify.unsubscribe(subscriber);2612 console.info("======ANS_Remove_3200 setTimeout unsubscribe============>");2613 await notify.cancelAll();2614 done();2615 }),timeout);2616 })2617 function OnConsumeRemoveByNotificationKeyWrongBundle(data) {2618 console.info("==============ANS_Remove_3300 onConsume start===============>");2619 console.info("==============ANS_Remove_3300 onConsume data:===============>" + JSON.stringify(data));2620 var bundleOption = {2621 bundle:"wrongBundleName",2622 uid:0,2623 }2624 var notificationKey = {2625 id:33,2626 label:"3300"2627 }2628 notify.remove(bundleOption,notificationKey,removeByNotificationKeyCBWrongBundle);2629 console.info("==============ANS_Remove_3300 onConsume remove===============>");2630 console.info("==============ANS_Remove_3300 onConsume end==================>");2631 }2632 function OnCancelRemoveByNotificationKeyWrongBundle(data) {2633 console.info("==============ANS_Remove_3300 onCancel start=============>");2634 console.info("==============ANS_Remove_3300 onCancel data:===========>" + JSON.stringify(data));2635 expect().assertFail();2636 console.info("==============ANS_Remove_3300 onCancel end=============>");2637 }2638 function removeByNotificationKeyCBWrongBundle(err, data) {2639 console.info("===========ANS_Remove_3300 removeCallback start==========>");2640 console.info("===========ANS_Remove_3300 removeCallback err============>" + JSON.stringify(err));2641 expect(err.code != 0).assertEqual(true);2642 console.info("===========ANS_Remove_3300 removeCallback data===========>" + JSON.stringify(data));2643 console.info("===========ANS_Remove_3300 removeCallback end============>");2644 }2645 /*2646 * @tc.number: ANS_Remove_33002647 * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback<void>): void;2648 * @tc.desc: Verify that the calling interface remove(bundle: BundleOption, notificationKey: NotificationKey,2649 * callback: AsyncCallback<void>): void; deletes notification information through BundleOption and2650 * NotificationKey wrong bundleOption,correct notificationKey.2651 */2652 it('ANS_Remove_3300', 0, async function (done) {2653 console.info("===============ANS_Remove_3300 start==========================>");2654 var subscriber ={2655 onConsume:OnConsumeRemoveByNotificationKeyWrongBundle,2656 onCancel:OnCancelRemoveByNotificationKeyWrongBundle,2657 }2658 await notify.subscribe(subscriber);2659 console.info("================ANS_Remove_3300 subscribe promise==================>");2660 var notificationRequest = {2661 content:{2662 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,2663 normal: {2664 title: "test_title",2665 text: "test_text",2666 additionalText: "test_additionalText"2667 },2668 },2669 id: 33,2670 slotType : notify.SlotType.OTHER_TYPES,2671 isOngoing : true,2672 isUnremovable : false,2673 deliveryTime : 1624950453,2674 tapDismissed : true,2675 autoDeletedTime: 1625036817,2676 color: 2,2677 colorEnabled: true,2678 isAlertOnce: true,2679 isStopwatch: true,2680 isCountDown: true,2681 progressValue: 12,2682 progressMaxValue: 100,2683 isIndeterminate: true,2684 statusBarText: "statusBarText",2685 isFloatingIcon : true,2686 label: "3300",2687 badgeIconStyle: 1,2688 showDeliveryTime: true,2689 }2690 await notify.publish(notificationRequest);2691 console.info("================ANS_Remove_3300 publish promise=================>");2692 setTimeout((async function(){2693 console.info("======ANS_Remove_3300 setTimeout============>");2694 await notify.unsubscribe(subscriber);2695 console.info("======ANS_Remove_3300 setTimeout unsubscribe============>");2696 await notify.cancelAll();2697 done();2698 }),timeout);2699 })2700 function onConsumeRemoveByNotificationKeyWrongBundlePromise(data) {2701 console.info("===========ANS_Remove_3400 onConsume start============>");2702 console.info("===========ANS_Remove_3400 onConsume data:============>" + JSON.stringify(data));2703 var bundleOption = {2704 bundle:"wrongBundleName",2705 uid:0,2706 }2707 var notificationKey = {2708 id:34,2709 label:"3400"2710 }2711 notify.remove(bundleOption, notificationKey)2712 console.info("===========ANS_Remove_3400 onConsume remove=========>");2713 console.info("===========ANS_Remove_3400 onConsume end============>");2714 }2715 function onCancelRemoveByNotificationKeyWrongBundlePromise(data) {2716 console.info("===========ANS_Remove_3400 onCancel start=============>");2717 console.info("===========ANS_Remove_3400 onCancel data: ============>" + JSON.stringify(data));2718 expect().assertFail();2719 console.info("===========ANS_Remove_3400 onCancel end===============>");2720 }2721 /*2722 * @tc.number: ANS_Remove_34002723 * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback<void>): void;2724 * @tc.desc: Verify that the calling interface remove(bundle: BundleOption, notificationKey: NotificationKey):2725 * Promise<void> deletes notification information through BundleOption and NotificationKey correct2726 * bundleOption,wrong notificationKey.2727 */2728 it('ANS_Remove_3400', 0, async function (done) {2729 console.info("===============ANS_Remove_3400 start==========================>");2730 var subscriber ={2731 onConsume:onConsumeRemoveByNotificationKeyWrongBundlePromise,2732 onCancel:onCancelRemoveByNotificationKeyWrongBundlePromise,2733 }2734 await notify.subscribe(subscriber);2735 console.info("============ANS_Remove_3400 subscribe promise==================>");2736 var notificationRequest = {2737 content:{2738 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,2739 normal: {2740 title: "test_title",2741 text: "test_text",2742 additionalText: "test_additionalText"2743 },2744 },2745 id: 34,2746 slotType : notify.SlotType.OTHER_TYPES,2747 isOngoing : true,2748 isUnremovable : false,2749 deliveryTime : 1624950453,2750 tapDismissed : true,2751 autoDeletedTime: 1625036817,2752 color: 2,2753 colorEnabled: true,2754 isAlertOnce: true,2755 isStopwatch: true,2756 isCountDown: true,2757 progressValue: 12,2758 progressMaxValue: 100,2759 isIndeterminate: true,2760 statusBarText: "statusBarText",2761 isFloatingIcon : true,2762 label: "3400",2763 badgeIconStyle: 1,2764 showDeliveryTime: true,2765 }2766 await notify.publish(notificationRequest);2767 console.info("============ANS_Remove_3400 publish promise==================>");2768 setTimeout((async function(){2769 console.info("======ANS_Remove_3400 setTimeout============>");2770 await notify.unsubscribe(subscriber);2771 console.info("======ANS_Remove_3400 setTimeout unsubscribe============>");2772 await notify.cancelAll();2773 done();2774 }),timeout);2775 })2776 function removeByNotificationKey2Times2CB(err,data) {2777 console.info("==========ANS_Remove_3500 removeCallback2Times2 start============>");2778 console.info("==========ANS_Remove_3500 removeCallback2Times2 err==============>" + JSON.stringify(err));2779 console.info("==========ANS_Remove_3500 removeCallback2Times2 data============>" + JSON.stringify(data));2780 expect(err.code != 0).assertEqual(true);2781 console.info("==========ANS_Remove_3500 removeCallback2Times2 end================>");2782 }2783 function removeByNotificationKey2Times1CB(err,data) {2784 console.info("==========ANS_Remove_3500 removeCallback2Times1 start===========>");2785 console.info("==========ANS_Remove_3500 removeCallback2Times1 err=============>" + JSON.stringify(err));2786 console.info("==========ANS_Remove_3500 removeCallback2Times1 data============>" + JSON.stringify(data));2787 expect(err.code).assertEqual(0);2788 var bundleOption = {2789 bundle:data.request.creatorBundleName,2790 uid:data.request.creatorUid,2791 }2792 var notificationKey = {2793 id:35,2794 label:"3500"2795 }2796 notify.remove(bundleOption,notificationKey,removeByNotificationKey2Times2CB);2797 console.info("==========ANS_Remove_3500 removeCallback2Times1 remove===========>");2798 console.info("==========ANS_Remove_3500 removeCallback2Times1 end==============>");2799 }2800 function onConsumeRemoveByNotificationKey2Times(data) {2801 console.info("=========ANS_Remove_3500 onConsume start=======================>");2802 console.info("=========ANS_Remove_3500 onConsume data:=========>" + JSON.stringify(data));2803 var bundleOption = {2804 bundle:data.request.creatorBundleName,2805 uid:data.request.creatorUid,2806 }2807 var notificationKey = {2808 id:35,2809 label:"3500"2810 }2811 notify.remove(bundleOption,notificationKey,removeByNotificationKey2Times1CB);2812 console.info("=========ANS_Remove_3500 onConsume remove==============>");2813 console.info("=========ANS_Remove_3500 onConsume end=================>");2814 }2815 var timesOfOnCancelRemoveByNotificationKey2Times2816 function onCancelRemoveByNotificationKey2Times(data) {2817 timesOfOnCancelRemoveByNotificationKey2Times = timesOfOnCancelRemoveByNotificationKey2Times + 12818 console.info("=========ANS_Remove_3500 onCancel start===============>");2819 console.info("=========ANS_Remove_3500 onCancel data : ========>" + JSON.stringify(data));2820 if (timesOfOnCancelRemoveByNotificationKey2Times == 1){2821 expect(data.request.id).assertEqual(35);2822 expect(data.request.label).assertEqual("3500");2823 } else if (timesOfOnCancelRemoveByNotificationKey2Times == 2){2824 expect().assertFail();2825 }2826 console.info("=========ANS_Remove_3500 onCancel end=======================>");2827 }2828 /*2829 * @tc.number: ANS_Remove_35002830 * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback<void>): void;2831 * @tc.desc: Verify that the interface remove(bundle: BundleOption, notificationKey: NotificationKey, callback:2832 * AsyncCallback<void>): void; void; is called twice in a row to delete the notification information2833 */2834 it('ANS_Remove_3500', 0, async function (done) {2835 console.info("===============ANS_Remove_3500 start==========================>");2836 timesOfOnCancelRemoveByNotificationKey2Times = 02837 var subscriber ={2838 onConsume:onConsumeRemoveByNotificationKey2Times,2839 onCancel:onCancelRemoveByNotificationKey2Times,2840 }2841 await notify.subscribe(subscriber);2842 console.info("===========ANS_Remove_3500 subscribe promise==================>");2843 var notificationRequest = {2844 content:{2845 contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,2846 normal: {2847 title: "test_title",2848 text: "test_text",2849 additionalText: "test_additionalText"2850 },2851 },2852 id: 35,2853 slotType : notify.SlotType.OTHER_TYPES,2854 isOngoing : true,2855 isUnremovable : false,2856 deliveryTime : 1624950453,2857 tapDismissed : true,2858 autoDeletedTime: 1625036817,2859 color: 2,2860 colorEnabled: true,2861 isAlertOnce: true,2862 isStopwatch: true,2863 isCountDown: true,2864 progressValue: 12,2865 progressMaxValue: 100,2866 isIndeterminate: true,2867 statusBarText: "statusBarText",2868 isFloatingIcon : true,2869 label: "3500",2870 badgeIconStyle: 1,2871 showDeliveryTime: true,2872 }2873 await notify.publish(notificationRequest);2874 console.info("============ANS_Remove_3500 publish promise==================>");2875 setTimeout((async function(){2876 console.info("======ANS_Remove_3500 setTimeout============>");2877 await notify.unsubscribe(subscriber);2878 console.info("======ANS_Remove_3500 setTimeout unsubscribe============>");2879 await notify.cancelAll();2880 done();2881 }),timeout);2882 })2883 function onConsumeRemoveByNotificationKey2TimesPromise(data) {2884 console.info("=========ANS_Remove_3600 onConsume start===========>");2885 console.info("=========ANS_Remove_3600 onConsume data: =======================>" + JSON.stringify(data));2886 var bundleOption = {2887 bundle:data.request.creatorBundleName,2888 uid:data.request.creatorUid,2889 }2890 var notificationKey = {2891 id:36,2892 label:"3600"2893 }2894 notify.remove(bundleOption, notificationKey)2895 console.info("=========ANS_Remove_3600 onConsume remove1===========>");2896 notify.remove(bundleOption, notificationKey);2897 console.info("=========ANS_Remove_3600 onConsume remove2===========>");2898 console.info("=========ANS_Remove_3600 onConsume end===========>");2899 }2900 var timesOnCancelcbRemoveByKey2TimesPromise2901 function onCancelRemoveByNotificationKey2TimesPromise(data) {2902 timesOnCancelcbRemoveByKey2TimesPromise = timesOnCancelcbRemoveByKey2TimesPromise + 12903 console.info("=========ANS_Remove_3600 onCancel start=============>");2904 console.info("=========ANS_Remove_3600 onCancel data:=============>" + JSON.stringify(data));2905 if (timesOnCancelcbRemoveByKey2TimesPromise == 1){2906 expect(data.request.id).assertEqual(36);2907 expect(data.request.label).assertEqual("3600");2908 } else if (timesOnCancelcbRemoveByKey2TimesPromise == 2){2909 expect().assertFail();2910 }2911 console.info("=========ANS_Remove_3600 onCancel end=============>");2912 }2913 /*2914 * @tc.number: ANS_Remove_36002915 * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey): Promise<void>;2916 * @tc.desc: Verify that the interface remove(bundle: BundleOption, notificationKey: NotificationKey):2917 * Promise<void> is called twice in a row to delete the notification information2918 */2919 it('ANS_Remove_3600', 0, async function (done) {2920 console.info("===============ANS_Remove_3600 start==========================>");2921 timesOnCancelcbRemoveByKey2TimesPromise = 02922 timesOnCancelcbRemoveByKey2TimesPromise = 02923 var subscriber ={2924 onConsume:onConsumeRemoveByNotificationKey2TimesPromise,2925 onCancel:onCancelRemoveByNotificationKey2TimesPromise,2926 }2927 await notify.subscribe(subscriber);2928 console.info("========ANS_Remove_3600 subscribe promise=============>");2929 var notificationRequest = {2930 content:{...

Full Screen

Full Screen

unit.js

Source:unit.js Github

copy

Full Screen

...8 9 // submit unit form function10 $("#submitUnitForm").unbind('submit').bind('submit', function () {11 // remove the error text12 $(".text-danger").remove();13 // remove the form error14 $('.form-group').removeClass('has-error').removeClass('has-success');15 16 var unitName = $("#unitName").val();17 var unitShortName = $("#unitShortName").val();18 19 if (unitName == "") {20 $("#unitName").after('<p class="text-danger">Unit Name field is required</p>');21 $('#unitName').closest('.form-group').addClass('has-error');22 } else {23 // remov error text field24 $("#unitName").find('.text-danger').remove();25 // success out for form 26 $("#unitName").closest('.form-group').addClass('has-success');27 }28 29 if (unitShortName == "") {30 $("#unitShortName").after('<p class="text-danger">Unit Short Name field is required</p>');31 32 $('#unitShortName').closest('.form-group').addClass('has-error');33 } else {34 // remov error text field35 $("#unitShortName").find('.text-danger').remove();36 // success out for form 37 $("#unitShortName").closest('.form-group').addClass('has-success');38 }39 40 if (unitName && unitShortName) {41 var form = $(this);42 // button loading43 $("#createunitBtn").button('loading');44 45 $.ajax({46 url: form.attr('action'),47 type: form.attr('method'),48 data: form.serialize(),49 dataType: 'json',50 success: function (response) {51 52 console.log(response);53 // button loading54 $("#createUnitBtn").button('reset');55 56 if (response.success == true) {57 // reload the manage member table 58 // manageunitTable.ajax.reload(null, false);59 loadUnits();60 61 // reset the form text62 $("#submitUnitForm")[0].reset();63 // remove the error text64 $(".text-danger").remove();65 // remove the form error66 $('.form-group').removeClass('has-error').removeClass('has-success');67 68 $('#add-unit-messages').html('<div class="alert alert-success">' +69 '<button type="button" class="close" data-dismiss="alert">&times;</button>' +70 '<strong><i class="glyphicon glyphicon-ok-sign"></i></strong> ' + response.messages +71 '</div>');72 73 $(".alert-success").delay(500).show(10, function () {74 $(this).delay(3000).hide(10, function () {75 $(this).remove();76 });77 }); // /.alert78 } // if79 80 } // /success81 }); // /ajax 82 } // if83 84 return false;85 }); // /submit unit form function86 87 });88 89 function editUnits(unitId = null) {90 if (unitId) {91 // remove hidden unit id text92 $('#unitId').remove();93 94 // remove the error 95 $('.text-danger').remove();96 // remove the form-error97 $('.form-group').removeClass('has-error').removeClass('has-success');98 99 // modal loading100 $('.modal-loading').removeClass('div-hide');101 // modal result102 $('.edit-unit-result').addClass('div-hide');103 // modal footer104 $('.editUnitFooter').addClass('div-hide');105 106 $.ajax({107 url: '/api/fetchSelectedUnit',108 type: 'post',109 data: {110 unitId: unitId111 },112 dataType: 'json',113 success: function (response) {114 // modal loading115 $('.modal-loading').addClass('div-hide');116 // modal result117 $('.edit-unit-result').removeClass('div-hide');118 // modal footer119 $('.editUnitFooter').removeClass('div-hide');120 121 // setting the unit name value 122 $('#editUnitName').val(response.data.unit_name);123 // setting the unit status value124 $('#editUnitShortName').val(response.data.unit_short_name);125 // unit id 126 $(".editUnitFooter").after('<input type="hidden" name="unitId" id="unitId" value="' + response.data.unit_id + '" />');127 128 // update unit form 129 $('#editUnitForm').unbind('submit').bind('submit', function () {130 131 // remove the error text132 $(".text-danger").remove();133 // remove the form error134 $('.form-group').removeClass('has-error').removeClass('has-success');135 136 var unitName = $('#editUnitName').val();137 var unitShortName = $('#editUnitShortName').val();138 139 if (unitName == "") {140 $("#editUnitName").after('<p class="text-danger">Unit Name field is required</p>');141 $('#editUnitName').closest('.form-group').addClass('has-error');142 } else {143 // remov error text field144 $("#editUnitName").find('.text-danger').remove();145 // success out for form 146 $("#editUnitName").closest('.form-group').addClass('has-success');147 }148 149 if (unitShortName == "") {150 $("#editUnitShortName").after('<p class="text-danger">Unit Short Name field is required</p>');151 152 $('#editUnitShortName').closest('.form-group').addClass('has-error');153 } else {154 // remove error text field155 $("#editUnitShortName").find('.text-danger').remove();156 // success out for form 157 $("#editUnitShortName").closest('.form-group').addClass('has-success');158 }159 160 if (unitName && unitShortName) {161 var form = $(this);162 console.log('triggered')163 164 // submit btn165 $('#editUnitBtn').button('loading');166 167 $.ajax({168 url: form.attr('action'),169 type: form.attr('method'),170 data: form.serialize(),171 dataType: 'json',172 success: function (response) {173 174 if (response.success == true) {175 // submit btn176 $('#editUnitBtn').button('reset');177 178 // reload the manage member table 179 // manageunitTable.ajax.reload(null, false);180 loadUnits()181 182 // remove the error text183 $(".text-danger").remove();184 // remove the form error185 $('.form-group').removeClass('has-error').removeClass('has-success');186 187 $('#edit-unit-messages').html('<div class="alert alert-success">' +188 '<button type="button" class="close" data-dismiss="alert">&times;</button>' +189 '<strong><i class="glyphicon glyphicon-ok-sign"></i></strong> ' + response.messages +190 '</div>');191 192 $(".alert-success").delay(500).show(10, function () {193 $(this).delay(3000).hide(10, function () {194 $(this).remove();195 });196 }); // /.alert197 } // /if198 199 } // /success200 }); // /ajax 201 } // /if202 203 return false;204 }); // /update unit form205 206 } // /success207 }); // ajax function208 209 } else {210 alert('error!! Refresh the page again');211 }212 } // /edit units function213 214 function removeUnits(unitId = null) {215 if (unitId) {216 $('#removeUnitId').remove();217 $.ajax({218 url: '/api/fetchSelectedunit',219 type: 'post',220 data: {221 unitId: unitId222 },223 dataType: 'json',224 success: function (response) {225 $('.removeUnitFooter').after('<input type="hidden" name="removeUnitId" id="removeUnitId" value="' + response.unit_id + '" /> ');226 227 // click on remove button to remove the unit228 $("#removeUnitBtn").unbind('click').bind('click', function () {229 // button loading230 $("#removeUnitBtn").button('loading');231 232 $.ajax({233 url: '/api/removeUnit',234 type: 'post',235 data: {236 unitId: unitId237 },238 dataType: 'json',239 success: function (response) {240 console.log(response);241 // button loading242 $("#removeUnitBtn").button('reset');243 if (response.success == true) {244 245 // hide the remove modal 246 $('#removeMemberModal').modal('hide');247 248 // reload the unit table 249 // manageunitTable.ajax.reload(null, false);250 loadUnits();251 252 $('.remove-messages').html('<div class="alert alert-success">' +253 '<button type="button" class="close" data-dismiss="alert">&times;</button>' +254 '<strong><i class="glyphicon glyphicon-ok-sign"></i></strong> ' + response.messages +255 '</div>');256 257 $(".alert-success").delay(500).show(10, function () {258 $(this).delay(3000).hide(10, function () {259 $(this).remove();260 });261 }); // /.alert262 } else {263 264 } // /else265 } // /response messages266 }); // /ajax function to remove the unit267 268 }); // /click on remove button to remove the unit269 270 } // /success271 }); // /ajax272 273 $('.removeUnitFooter').after();...

Full Screen

Full Screen

DestroyMethodTests.js

Source:DestroyMethodTests.js Github

copy

Full Screen

1describe("'destroy()' Method tests", function() {2 var testSlider;3 it("removes the extra DOM elements associated with a slider", function() {4 testSlider = new Slider("#testSlider1", {5 id: "destroyMethodTestSlider"6 });7 testSlider.destroy();8 var sliderParentElement = $("#testSlider1").parent('div.slider').length;9 var sliderChildrenElements = $("#testSlider1").siblings('div.slider-track, div.tooltip').length;10 expect(sliderParentElement).toBe(0);11 expect(sliderChildrenElements).toBe(0);12 });13 describe("unbinds all slider events", function() {14 var flag, evtName;15 beforeEach(function() {16 testSlider = new Slider("#testSlider1", {17 id: "destroyMethodTestSlider"18 });19 flag = false;20 });21 it("unbinds from 'slideStart' event", function() {22 evtName = 'slideStart';23 $("#destroyMethodTestSlider").on(evtName, function() {24 flag = true;25 });26 testSlider.destroy();27 $("#destroyMethodTestSlider").trigger(evtName);28 expect(flag).toBeFalsy();29 });30 it("unbinds from 'slide' event", function() {31 evtName = 'slide';32 $("#destroyMethodTestSlider").on(evtName, function() {33 flag = true;34 });35 testSlider.destroy();36 $("#destroyMethodTestSlider").trigger(evtName);37 expect(flag).toBeFalsy();38 });39 it("unbinds from 'slideStop' event", function() {40 evtName = 'slideStop';41 $("#destroyMethodTestSlider").on(evtName, function() {42 flag = true;43 });44 testSlider.destroy();45 $("#destroyMethodTestSlider").trigger(evtName);46 expect(flag).toBeFalsy();47 });48 it("unbinds from 'slideChange' event", function() {49 evtName = 'slideChange';50 $("#destroyMethodTestSlider").on(evtName, function() {51 flag = true;52 });53 testSlider.destroy();54 $("#destroyMethodTestSlider").trigger(evtName);55 expect(flag).toBeFalsy();56 });57 });58 describe("DOM event listener removal tests", function() {59 describe("When tooltips are always hidden for single value sliders", function() {60 beforeEach(function() {61 // Create slider62 testSlider = new Slider("#testSlider1", {63 id: "destroyMethodTestSlider",64 tooltip: "hide"65 });66 });67 it("does not try to remove 'focus' event listener from handle1", function() {68 // Set up spy on 'removeEventListener'69 spyOn(testSlider.handle1, "removeEventListener");70 // Destroy slider71 testSlider.destroy();72 // Assert73 expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("focus", undefined, false);74 });75 it("does not try to remove 'blur' event listener from handle1", function() {76 // Set up spy on 'removeEventListener'77 spyOn(testSlider.handle1, "removeEventListener");78 // Destroy slider79 testSlider.destroy();80 // Assert81 expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("blur", undefined, false);82 });83 it("does not try to remove 'mouseenter' event listener from slider", function() {84 // Set up spy on 'removeEventListener'85 spyOn(testSlider.sliderElem, "removeEventListener");86 // Destroy slider87 testSlider.destroy();88 // Assert89 expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseenter", undefined, false);90 });91 it("does not try to remove 'mouseleave' event listener from slider", function() {92 // Set up spy on 'removeEventListener'93 spyOn(testSlider.sliderElem, "removeEventListener");94 // Destroy slider95 testSlider.destroy();96 // Assert97 expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseleave", undefined, false);98 });99 });100 describe("When tooltips are always shown for single value sliders", function() {101 beforeEach(function() {102 // Create slider103 testSlider = new Slider("#testSlider1", {104 id: "destroyMethodTestSlider",105 tooltip: "always"106 });107 });108 it("does not try to remove 'focus' event listener from handle1 when tooltip is always shown for single handle sliders", function() {109 // Set up spy on 'removeEventListener'110 spyOn(testSlider.handle1, "removeEventListener");111 // Destroy slider112 testSlider.destroy();113 // Assert114 expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("focus", undefined, false);115 });116 it("does not try to remove 'blur' event listener from handle1 when tooltip is always shown for single handle sliders", function() {117 // Set up spy on 'removeEventListener'118 spyOn(testSlider.handle1, "removeEventListener");119 // Destroy slider120 testSlider.destroy();121 // Assert122 expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("blur", undefined, false);123 });124 it("does not try to remove 'mouseenter' event listener from slider is always shown for single handle slider", function() {125 // Set up spy on 'removeEventListener'126 spyOn(testSlider.handle1, "removeEventListener");127 // Destroy slider128 testSlider.destroy();129 // Assert130 expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("mouseenter", undefined, false);131 });132 it("does not try to remove 'mouseleave' event listener from slider is always shown for single handle slider", function() {133 // Set up spy on 'removeEventListener'134 spyOn(testSlider.sliderElem, "removeEventListener");135 // Destroy slider136 testSlider.destroy();137 // Assert138 expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseleave", undefined, false);139 });140 });141 describe("When tooltips are always hidden for range sliders", function() {142 beforeEach(function() {143 // Create slider144 testSlider = new Slider("#testSlider1", {145 id: "destroyMethodTestSlider",146 tooltip: "always",147 value: [2,5]148 });149 });150 it("does not try to remove 'focus' event listener from handle1", function() {151 // Set up spy on 'removeEventListener'152 spyOn(testSlider.handle1, "removeEventListener");153 // Destroy slider154 testSlider.destroy();155 // Assert156 expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("focus", undefined, false);157 });158 it("does not try to remove 'focus' event listener from handle2", function() {159 // Set up spy on 'removeEventListener'160 spyOn(testSlider.handle2, "removeEventListener");161 // Destroy slider162 testSlider.destroy();163 // Assert164 expect(testSlider.handle2.removeEventListener).not.toHaveBeenCalledWith("focus", undefined, false);165 });166 it("does not try to remove 'blur' event listener from handle1", function() {167 // Set up spy on 'removeEventListener'168 spyOn(testSlider.handle1, "removeEventListener");169 // Destroy slider170 testSlider.destroy();171 // Assert172 expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("blur", undefined, false);173 });174 it("does not try to remove 'blur' event listener from handle2", function() {175 // Set up spy on 'removeEventListener'176 spyOn(testSlider.handle2, "removeEventListener");177 // Destroy slider178 testSlider.destroy();179 // Assert180 expect(testSlider.handle2.removeEventListener).not.toHaveBeenCalledWith("blur", undefined, false);181 });182 it("does not try to remove 'mouseenter' event listener from slider", function() {183 // Set up spy on 'removeEventListener'184 spyOn(testSlider.sliderElem, "removeEventListener");185 // Destroy slider186 testSlider.destroy();187 // Assert188 expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseenter", undefined, false);189 });190 it("does not try to remove 'mouseleave' event listener from slider", function() {191 // Set up spy on 'removeEventListener'192 spyOn(testSlider.sliderElem, "removeEventListener");193 // Destroy slider194 testSlider.destroy();195 // Assert196 expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseleave", undefined, false);197 });198 });199 describe("When tooltips are always shown for range sliders", function() {200 beforeEach(function() {201 // Create slider202 testSlider = new Slider("#testSlider1", {203 id: "destroyMethodTestSlider",204 tooltip: "always",205 value: [2,5]206 });207 });208 it("does not try to remove 'focus' event listener from handle1", function() {209 // Set up spy on 'removeEventListener'210 spyOn(testSlider.handle1, "removeEventListener");211 // Destroy slider212 testSlider.destroy();213 // Assert214 expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("focus", undefined, false);215 });216 217 it("does not try to remove 'focus' event listener from handle2", function() {218 // Set up spy on 'removeEventListener'219 spyOn(testSlider.handle2, "removeEventListener");220 // Destroy slider221 testSlider.destroy();222 // Assert223 expect(testSlider.handle2.removeEventListener).not.toHaveBeenCalledWith("focus", undefined, false);224 });225 it("does not try to remove 'blur' event listener from handle1", function() {226 // Set up spy on 'removeEventListener'227 spyOn(testSlider.handle1, "removeEventListener");228 // Destroy slider229 testSlider.destroy();230 // Assert231 expect(testSlider.handle1.removeEventListener).not.toHaveBeenCalledWith("blur", undefined, false);232 });233 234 it("does not try to remove 'blur' event listener from handle1 and handle2", function() {235 // Set up spy on 'removeEventListener'236 spyOn(testSlider.handle2, "removeEventListener");237 // Destroy slider238 testSlider.destroy();239 // Assert240 expect(testSlider.handle2.removeEventListener).not.toHaveBeenCalledWith("blur", undefined, false);241 });242 it("does not try to remove 'mouseenter' event listener from slider", function() {243 // Set up spy on 'removeEventListener'244 spyOn(testSlider.sliderElem, "removeEventListener");245 // Destroy slider246 testSlider.destroy();247 // Assert248 expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseenter", undefined, false);249 });250 it("does not try to remove 'mouseleave' event listener from slider", function() {251 // Set up spy on 'removeEventListener'252 spyOn(testSlider.sliderElem, "removeEventListener");253 // Destroy slider254 testSlider.destroy();255 // Assert256 expect(testSlider.sliderElem.removeEventListener).not.toHaveBeenCalledWith("mouseleave", undefined, false);257 });258 });259 });...

Full Screen

Full Screen

ExampleJsunit.test.js

Source:ExampleJsunit.test.js Github

copy

Full Screen

1/*2 * Copyright (c) 2021 Huawei Device 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 at6 *7 * http://www.apache.org/licenses/LICENSE-2.08 *9 * Unless required by applicable law or agreed to in writing, software10 * 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 and13 * limitations under the License.14 */15import notification from '@ohos.notification'16import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'17const TIMEOUT = 2000;18describe('ActsAnsRemoveSlotWithoutAdd', function () {19 /*20 * @tc.number : ActsAnsRemoveSlotWithoutAdd_010021 * @tc.name : removeSlot callback22 * @tc.desc : remove the SOCIAL_COMMUNICATION type slot without adding23 */24 it('ActsAnsRemoveSlotWithoutAdd_0100', 0, async function (done) {25 console.debug("====>ActsAnsRemoveSlotWithoutAdd_0100 start====>");26 function removeSlotCallbck(err) {27 console.debug("====>removeSlotActsAnsGetSlotWithoutAdd_0100 enter====>");28 console.debug("====>removeSlot ActsAnsRemoveSlotWithoutAdd_0100 err:" + JSON.stringify(err));29 expect(err.code != 0).assertEqual(true);30 done();31 }32 console.debug("====>removeSlot callback SlotType.SOCIAL_COMMUNICATION====>");33 await notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, removeSlotCallbck);34 setTimeout(function(){35 console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0100====>");36 }, TIMEOUT);37 })38 /*39 * @tc.number : ActsAnsRemoveSlotWithoutAdd_020040 * @tc.name : removeSlot callback41 * @tc.desc : remove the SERVICE_INFORMATION type slot without adding42 */43 it('ActsAnsRemoveSlotWithoutAdd_0200', 0, async function (done) {44 console.debug("====>ActsAnsRemoveSlotWithoutAdd_0200 start====>");45 function removeSlotCallbck(err) {46 console.debug("====>ActsAnsRemoveSlotWithoutAdd_0200 enter====>");47 console.debug("====>removeSlot ActsAnsRemoveSlotWithoutAdd_0200 err:" + JSON.stringify(err));48 expect(err.code != 0).assertEqual(true);49 done();50 }51 console.debug("====>removeSlot callback SlotType.SERVICE_INFORMATION====>");52 await notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, removeSlotCallbck);53 setTimeout(function(){54 console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0200====>");55 }, TIMEOUT);56 })57 /*58 * @tc.number : ActsAnsRemoveSlotWithoutAdd_030059 * @tc.name : removeSlot callback60 * @tc.desc : remove the CONTENT_INFORMATION type slot without adding61 */62 it('ActsAnsRemoveSlotWithoutAdd_0300', 0, async function (done) {63 console.debug("====>ActsAnsRemoveSlotWithoutAdd_0300 start====>");64 function removeSlotCallbck(err) {65 console.debug("====>ActsAnsRemoveSlotWithoutAdd_0300 enter====>");66 console.debug("====>removeSlot ActsAnsRemoveSlotWithoutAdd_0300 err:" + JSON.stringify(err));67 expect(err.code != 0).assertEqual(true);68 done();69 }70 console.debug("====>removeSlot callback SlotType.CONTENT_INFORMATION====>");71 await notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, removeSlotCallbck);72 setTimeout(function(){73 console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0300====>");74 }, TIMEOUT);75 })76 /*77 * @tc.number : ActsAnsRemoveSlotWithoutAdd_040078 * @tc.name : removeSlot callback79 * @tc.desc : remove the OTHER_TYPES type slot without adding80 */81 it('ActsAnsRemoveSlotWithoutAdd_0400', 0, async function (done) {82 console.debug("====>ActsAnsRemoveSlotWithoutAdd_0400 start====>");83 function removeSlotCallbck(err) {84 console.debug("====>ActsAnsRemoveSlotWithoutAdd_0400 enter====>");85 console.debug("====>removeSlot ActsAnsRemoveSlotWithoutAdd_0400 err:" + JSON.stringify(err));86 expect(err.code != 0).assertEqual(true);87 done();88 }89 console.debug("====>removeSlot callback SlotType.OTHER_TYPES====>");90 await notification.removeSlot(notification.SlotType.OTHER_TYPES, removeSlotCallbck);91 setTimeout(function(){92 console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0400====>");93 }, TIMEOUT);94 })95 /*96 * @tc.number : ActsAnsRemoveSlotWithoutAdd_050097 * @tc.name : removeSlot callback98 * @tc.desc : remove the UNKNOWN_TYPE type slot without adding99 */100 it('ActsAnsRemoveSlotWithoutAdd_0500', 0, async function (done) {101 console.debug("====>ActsAnsRemoveSlotWithoutAdd_0500 start====>");102 function removeSlotCallbck(err) {103 console.debug("====>ActsAnsRemoveSlotWithoutAdd_0500 enter====>");104 console.debug("====>removeSlot ActsAnsRemoveSlotWithoutAdd_0500 err:" + JSON.stringify(err));105 expect(err.code != 0).assertEqual(true);106 done();107 }108 console.debug("====>removeSlot callback SlotType.UNKNOWN_TYPE====>");109 await notification.removeSlot(notification.SlotType.UNKNOWN_TYPE, removeSlotCallbck);110 setTimeout(function(){111 console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0500====>");112 }, TIMEOUT);113 })114 /*115 * @tc.number : ActsAnsRemoveSlotWithoutAdd_0600116 * @tc.name : removeSlot promise117 * @tc.desc : remove the SOCIAL_COMMUNICATION type slot without adding118 */119 it('ActsAnsRemoveSlotWithoutAdd_0600', 0, async function (done) {120 console.debug("====>ActsAnsRemoveSlotWithoutAdd_0600 start====>");121 console.debug("====>removeSlot SlotType.SOCIAL_COMMUNICATION====>");122 notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION).then(()=>{123 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0600 enter====>");124 expect().assertFail();125 done();126 }).catch((err)=>{127 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0600 err:" + JSON.stringify(err));128 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0600 end====>");129 expect(err.code != 0).assertEqual(true);130 done();131 })132 setTimeout(function(){133 console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0600====>");134 }, TIMEOUT);135 })136 /*137 * @tc.number : ActsAnsRemoveSlotWithoutAdd_0700138 * @tc.name : removeSlot promise139 * @tc.desc : remove the SERVICE_INFORMATION type slot without adding140 */141 it('ActsAnsRemoveSlotWithoutAdd_0700', 0, async function (done) {142 console.debug("====>ActsAnsRemoveSlotWithoutAdd_0700 start====>");143 console.debug("====>removeSlot SlotType.SERVICE_INFORMATION====>");144 notification.removeSlot(notification.SlotType.SERVICE_INFORMATION).then(()=>{145 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0700 enter====>");146 expect().assertFail();147 done();148 }).catch((err)=>{149 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0700 err:" + JSON.stringify(err));150 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0700 end====>");151 expect(err.code != 0).assertEqual(true);152 done();153 })154 setTimeout(function(){155 console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0700====>");156 }, TIMEOUT);157 })158 /*159 * @tc.number : ActsAnsRemoveSlotWithoutAdd_0800160 * @tc.name : removeSlot promise161 * @tc.desc : remove the CONTENT_INFORMATION type slot without adding162 */163 it('ActsAnsRemoveSlotWithoutAdd_0800', 0, async function (done) {164 console.debug("====>ActsAnsRemoveSlotWithoutAdd_0800 start====>");165 console.debug("====>removeSlot SlotType.CONTENT_INFORMATION====>");166 notification.removeSlot(notification.SlotType.CONTENT_INFORMATION).then(()=>{167 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0800 enter====>");168 expect().assertFail();169 done();170 }).catch((err)=>{171 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0800 err:" + JSON.stringify(err));172 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0800 end====>");173 expect(err.code != 0).assertEqual(true);174 done();175 })176 setTimeout(function(){177 console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0800====>");178 }, TIMEOUT);179 })180 /*181 * @tc.number : ActsAnsRemoveSlotWithoutAdd_0900182 * @tc.name : removeSlot promise183 * @tc.desc : remove the OTHER_TYPES type slot without adding184 */185 it('ActsAnsRemoveSlotWithoutAdd_0900', 0, async function (done) {186 console.debug("====>ActsAnsRemoveSlotWithoutAdd_0900 start====>");187 console.debug("====>removeSlot SlotType.OTHER_TYPES====>");188 notification.removeSlot(notification.SlotType.OTHER_TYPES).then(()=>{189 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0900 enter====>");190 expect().assertFail();191 done();192 }).catch((err)=>{193 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0900 err:" + JSON.stringify(err));194 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0900 end====>");195 expect(err.code != 0).assertEqual(true);196 done();197 })198 setTimeout(function(){199 console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0900====>");200 }, TIMEOUT);201 })202 /*203 * @tc.number : ActsAnsRemoveSlotWithoutAdd_1000204 * @tc.name : removeSlot promise205 * @tc.desc : remove the UNKNOWN_TYPE type slot without adding206 */207 it('ActsAnsRemoveSlotWithoutAdd_1000', 0, async function (done) {208 console.debug("====>ActsAnsRemoveSlotWithoutAdd_1000 start====>");209 console.debug("====>removeSlot SlotType.UNKNOWN_TYPE====>");210 notification.removeSlot(notification.SlotType.UNKNOWN_TYPE).then(()=>{211 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_1000 enter====>");212 expect().assertFail();213 done();214 }).catch((err)=>{215 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_1000 err:" + JSON.stringify(err));216 console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_1000 end====>");217 expect(err.code != 0).assertEqual(true);218 done();219 })220 setTimeout(function(){221 console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_1000====>");222 }, TIMEOUT);223 })...

Full Screen

Full Screen

brand.js

Source:brand.js Github

copy

Full Screen

...6 7 // submit brand form function8 $("#submitBrandForm").unbind('submit').bind('submit', function () {9 // remove the error text10 $(".text-danger").remove();11 // remove the form error12 $('.form-group').removeClass('has-error').removeClass('has-success');13 var brandName = $("#brandName").val();14 var brandStatus = $("#brandStatus").val();15 if (brandName == "") {16 $("#brandName").after('<p class="text-danger">Brand Name field is required</p>');17 $('#brandName').closest('.form-group').addClass('has-error');18 } else {19 // remov error text field20 $("#brandName").find('.text-danger').remove();21 // success out for form 22 $("#brandName").closest('.form-group').addClass('has-success');23 }24 if (brandStatus == "") {25 $("#brandStatus").after('<p class="text-danger">Brand Name field is required</p>');26 $('#brandStatus').closest('.form-group').addClass('has-error');27 } else {28 // remov error text field29 $("#brandStatus").find('.text-danger').remove();30 // success out for form 31 $("#brandStatus").closest('.form-group').addClass('has-success');32 }33 if (brandName && brandStatus) {34 var form = $(this);35 // button loading36 $("#createBrandBtn").button('loading');37 $.ajax({38 url: form.attr('action'),39 type: form.attr('method'),40 data: form.serialize(),41 dataType: 'json',42 success: function (response) {43 console.log(response);44 // button loading45 $("#createBrandBtn").button('reset');46 if (response.success == true) {47 // reload the manage member table 48 // manageBrandTable.ajax.reload(null, false);49 loadBrands();50 // reset the form text51 $("#submitBrandForm")[0].reset();52 // remove the error text53 $(".text-danger").remove();54 // remove the form error55 $('.form-group').removeClass('has-error').removeClass('has-success');56 $('#add-brand-messages').html('<div class="alert alert-success">' +57 '<button type="button" class="close" data-dismiss="alert">&times;</button>' +58 '<strong><i class="glyphicon glyphicon-ok-sign"></i></strong> ' + response.messages +59 '</div>');60 $(".alert-success").delay(500).show(10, function () {61 $(this).delay(3000).hide(10, function () {62 $(this).remove();63 });64 }); // /.alert65 } // if66 } // /success67 }); // /ajax 68 } // if69 return false;70 }); // /submit brand form function71});72function editBrands(brandId = null) {73 if (brandId) {74 // remove hidden brand id text75 $('#brandId').remove();76 // remove the error 77 $('.text-danger').remove();78 // remove the form-error79 $('.form-group').removeClass('has-error').removeClass('has-success');80 // modal loading81 $('.modal-loading').removeClass('div-hide');82 // modal result83 $('.edit-brand-result').addClass('div-hide');84 // modal footer85 $('.editBrandFooter').addClass('div-hide');86 $.ajax({87 url: '/api/fetchSelectedBrand',88 type: 'post',89 data: {90 brandId: brandId91 },92 dataType: 'json',93 success: function (response) {94 // modal loading95 $('.modal-loading').addClass('div-hide');96 // modal result97 $('.edit-brand-result').removeClass('div-hide');98 // modal footer99 $('.editBrandFooter').removeClass('div-hide');100 // setting the brand name value 101 $('#editBrandName').val(response.data.brand_name);102 // setting the brand status value103 $('#editBrandStatus').val(response.data.brand_active);104 // brand id 105 $(".editBrandFooter").after('<input type="hidden" name="brandId" id="brandId" value="' + response.data.brand_id + '" />');106 // update brand form 107 $('#editBrandForm').unbind('submit').bind('submit', function () {108 // remove the error text109 $(".text-danger").remove();110 // remove the form error111 $('.form-group').removeClass('has-error').removeClass('has-success');112 var brandName = $('#editBrandName').val();113 var brandStatus = $('#editBrandStatus').val();114 if (brandName == "") {115 $("#editBrandName").after('<p class="text-danger">Brand Name field is required</p>');116 $('#editBrandName').closest('.form-group').addClass('has-error');117 } else {118 // remov error text field119 $("#editBrandName").find('.text-danger').remove();120 // success out for form 121 $("#editBrandName").closest('.form-group').addClass('has-success');122 }123 if (brandStatus == "") {124 $("#editBrandStatus").after('<p class="text-danger">Brand Name field is required</p>');125 $('#editBrandStatus').closest('.form-group').addClass('has-error');126 } else {127 // remove error text field128 $("#editBrandStatus").find('.text-danger').remove();129 // success out for form 130 $("#editBrandStatus").closest('.form-group').addClass('has-success');131 }132 if (brandName && brandStatus) {133 var form = $(this);134 // submit btn135 $('#editBrandBtn').button('loading');136 $.ajax({137 url: form.attr('action'),138 type: form.attr('method'),139 data: form.serialize(),140 dataType: 'json',141 success: function (response) {142 if (response.success == true) {143 // submit btn144 $('#editBrandBtn').button('reset');145 // reload the manage member table 146 // manageBrandTable.ajax.reload(null, false);147 loadBrands()148 // remove the error text149 $(".text-danger").remove();150 // remove the form error151 $('.form-group').removeClass('has-error').removeClass('has-success');152 $('#edit-brand-messages').html('<div class="alert alert-success">' +153 '<button type="button" class="close" data-dismiss="alert">&times;</button>' +154 '<strong><i class="glyphicon glyphicon-ok-sign"></i></strong> ' + response.messages +155 '</div>');156 $(".alert-success").delay(500).show(10, function () {157 $(this).delay(3000).hide(10, function () {158 $(this).remove();159 });160 }); // /.alert161 } // /if162 } // /success163 }); // /ajax 164 } // /if165 return false;166 }); // /update brand form167 } // /success168 }); // ajax function169 } else {170 alert('error!! Refresh the page again');171 }172} // /edit brands function173function removeBrands(brandId = null) {174 if (brandId) {175 $('#removeBrandId').remove();176 $.ajax({177 url: '/api/fetchSelectedBrand',178 type: 'post',179 data: {180 brandId: brandId181 },182 dataType: 'json',183 success: function (response) {184 $('.removeBrandFooter').after('<input type="hidden" name="removeBrandId" id="removeBrandId" value="' + response.brand_id + '" /> ');185 // click on remove button to remove the brand186 $("#removeBrandBtn").unbind('click').bind('click', function () {187 // button loading188 $("#removeBrandBtn").button('loading');189 $.ajax({190 url: '/api/removeBrand',191 type: 'post',192 data: {193 brandId: brandId194 },195 dataType: 'json',196 success: function (response) {197 console.log(response);198 // button loading199 $("#removeBrandBtn").button('reset');200 if (response.success == true) {201 // hide the remove modal 202 $('#removeMemberModal').modal('hide');203 // reload the brand table 204 // manageBrandTable.ajax.reload(null, false);205 loadBrands();206 $('.remove-messages').html('<div class="alert alert-success">' +207 '<button type="button" class="close" data-dismiss="alert">&times;</button>' +208 '<strong><i class="glyphicon glyphicon-ok-sign"></i></strong> ' + response.messages +209 '</div>');210 $(".alert-success").delay(500).show(10, function () {211 $(this).delay(3000).hide(10, function () {212 $(this).remove();213 });214 }); // /.alert215 } else {216 } // /else217 } // /response messages218 }); // /ajax function to remove the brand219 }); // /click on remove button to remove the brand220 } // /success221 }); // /ajax222 $('.removeBrandFooter').after();223 } else {224 alert('error!! Refresh the page again');225 }226} // /remove brands function...

Full Screen

Full Screen

color-switcher.js

Source:color-switcher.js Github

copy

Full Screen

1 jQuery(document).ready(function($) {2 3 jQuery("#blue" ).click(function(){4 jQuery("#color" ).attr("href", "css/blue.css");5 jQuery(".navbar-brand img" ).attr("src", "images/logo.png");6 return false;7 });8 9 jQuery("#green" ).click(function(){10 jQuery("#color" ).attr("href", "css/green.css");11 jQuery(".navbar-brand img" ).attr("src", "images/logo-green.png");12 return false;13 });14 15 jQuery("#red" ).click(function(){16 jQuery("#color" ).attr("href", "css/red.css");17 jQuery(".navbar-brand img" ).attr("src", "images/logo-red.png");18 return false;19 });20 21 22 jQuery("#yellow" ).click(function(){23 jQuery("#color" ).attr("href", "css/yellow.css");24 jQuery(".navbar-brand img" ).attr("src", "images/logo-yellow.png");25 return false;26 });27 28 jQuery("#brown" ).click(function(){29 jQuery("#color" ).attr("href", "css/brown.css");30 jQuery(".navbar-brand img" ).attr("src", "images/logo-brown.png");31 return false;32 });33 34 jQuery("#cyan" ).click(function(){35 jQuery("#color" ).attr("href", "css/cyan.css");36 jQuery(".navbar-brand img" ).attr("src", "images/logo-cyan.png");37 return false;38 });39 40 jQuery("#purple" ).click(function(){41 jQuery("#color" ).attr("href", "css/purple.css");42 jQuery(".navbar-brand img" ).attr("src", "images/logo-purple.png");43 return false;44 });45 46 jQuery("#sky-blue" ).click(function(){47 jQuery("#color" ).attr("href", "css/sky-blue.css");48 jQuery(".navbar-brand img" ).attr("src", "images/logo-sky-blue.png");49 return false;50 });51 52 jQuery("#theme-dark" ).click(function(){53 jQuery("#choose-theme" ).attr("href", "css/dark.css");54 jQuery(".navbar-brand img" ).attr("src", "images/logo-white.png");55 jQuery("#footer img" ).attr("src", "images/footer-logo-dark.jpg");56 jQuery(".lady1" ).attr("src", "images/appointment-img-dark.jpg");57 return false;58 });59 jQuery("#theme-light" ).click(function(){60 jQuery("#choose-theme" ).attr("href", "css/light.css");61 jQuery(".navbar-brand img" ).attr("src", "images/logo.png");62 jQuery("#footer img" ).attr("src", "images/footer-logo.jpg");63 jQuery(".lady1" ).attr("src", "images/appointment-img.jpg");64 return false;65 });66 67 68 69 70 71 jQuery(".layouts #boxed" ).click(function(){72 jQuery("#wrapper" ).addClass("boxed-layout");73 jQuery("body" ).addClass("bg1");74 });75 jQuery(".layouts #wide" ).click(function(){76 jQuery("#wrapper" ).removeClass("boxed-layout");77 jQuery("body" ).removeClass("bg1");78 });79 80 81 jQuery("#headerNormal" ).click(function(){82 jQuery("body" ).removeClass("fixed-header");83 });84 jQuery("#headerFixed" ).click(function(){85 jQuery("body" ).addClass("fixed-header");86 });87 88 //add backgrounds89 jQuery("#bg-one" ).click(function(){90 jQuery("body" ).addClass("bg1");91 jQuery("body" ).removeClass("bg2");92 jQuery("body" ).removeClass("bg3");93 jQuery("body" ).removeClass("bg4");94 jQuery("body" ).removeClass("bg5");95 jQuery("body" ).removeClass("bg6");96 jQuery("body" ).removeClass("bg7");97 jQuery("body" ).removeClass("bg8");98 jQuery("body" ).removeClass("bg9");99 jQuery("body" ).removeClass("bg10");100 });101 102 jQuery("#bg-two" ).click(function(){103 jQuery("body" ).removeClass("bg1");104 jQuery("body" ).addClass("bg2");105 jQuery("body" ).removeClass("bg3");106 jQuery("body" ).removeClass("bg4");107 jQuery("body" ).removeClass("bg5");108 jQuery("body" ).removeClass("bg6");109 jQuery("body" ).removeClass("bg7");110 jQuery("body" ).removeClass("bg8");111 jQuery("body" ).removeClass("bg9");112 jQuery("body" ).removeClass("bg10");113 });114 115 jQuery("#bg-three" ).click(function(){116 jQuery("body" ).removeClass("bg1");117 jQuery("body" ).removeClass("bg2");118 jQuery("body" ).addClass("bg3");119 jQuery("body" ).removeClass("bg4");120 jQuery("body" ).removeClass("bg5");121 jQuery("body" ).removeClass("bg6");122 jQuery("body" ).removeClass("bg7");123 jQuery("body" ).removeClass("bg8");124 jQuery("body" ).removeClass("bg9");125 jQuery("body" ).removeClass("bg10");126 });127 128 jQuery("#bg-four" ).click(function(){129 jQuery("body" ).removeClass("bg1");130 jQuery("body" ).removeClass("bg2");131 jQuery("body" ).removeClass("bg3");132 jQuery("body" ).addClass("bg4");133 jQuery("body" ).removeClass("bg5");134 jQuery("body" ).removeClass("bg6");135 jQuery("body" ).removeClass("bg7");136 jQuery("body" ).removeClass("bg8");137 jQuery("body" ).removeClass("bg9");138 jQuery("body" ).removeClass("bg10");139 });140 141 jQuery("#bg-five" ).click(function(){142 jQuery("body" ).removeClass("bg1");143 jQuery("body" ).removeClass("bg2");144 jQuery("body" ).removeClass("bg3");145 jQuery("body" ).removeClass("bg4");146 jQuery("body" ).addClass("bg5");147 jQuery("body" ).removeClass("bg6");148 jQuery("body" ).removeClass("bg7");149 jQuery("body" ).removeClass("bg8");150 jQuery("body" ).removeClass("bg9");151 jQuery("body" ).removeClass("bg10");152 });153 154 jQuery("#bg-six" ).click(function(){155 jQuery("body" ).removeClass("bg1");156 jQuery("body" ).removeClass("bg2");157 jQuery("body" ).removeClass("bg3");158 jQuery("body" ).removeClass("bg4");159 jQuery("body" ).removeClass("bg5");160 jQuery("body" ).addClass("bg6");161 jQuery("body" ).removeClass("bg7");162 jQuery("body" ).removeClass("bg8");163 jQuery("body" ).removeClass("bg9");164 jQuery("body" ).removeClass("bg10");165 });166 167 jQuery("#bg-seven" ).click(function(){168 jQuery("body" ).removeClass("bg1");169 jQuery("body" ).removeClass("bg2");170 jQuery("body" ).removeClass("bg3");171 jQuery("body" ).removeClass("bg4");172 jQuery("body" ).removeClass("bg5");173 jQuery("body" ).removeClass("bg6");174 jQuery("body" ).addClass("bg7");175 jQuery("body" ).removeClass("bg8");176 jQuery("body" ).removeClass("bg9");177 jQuery("body" ).removeClass("bg10");178 });179 180 jQuery("#bg-eight" ).click(function(){181 jQuery("body" ).removeClass("bg1");182 jQuery("body" ).removeClass("bg2");183 jQuery("body" ).removeClass("bg3");184 jQuery("body" ).removeClass("bg4");185 jQuery("body" ).removeClass("bg5");186 jQuery("body" ).removeClass("bg6");187 jQuery("body" ).removeClass("bg7");188 jQuery("body" ).addClass("bg8");189 jQuery("body" ).removeClass("bg9");190 jQuery("body" ).removeClass("bg10");191 });192 193 jQuery("#bg-nine" ).click(function(){194 jQuery("body" ).removeClass("bg1");195 jQuery("body" ).removeClass("bg2");196 jQuery("body" ).removeClass("bg3");197 jQuery("body" ).removeClass("bg4");198 jQuery("body" ).removeClass("bg5");199 jQuery("body" ).removeClass("bg6");200 jQuery("body" ).removeClass("bg7");201 jQuery("body" ).removeClass("bg8");202 jQuery("body" ).addClass("bg9");203 jQuery("body" ).removeClass("bg10");204 });205 206 jQuery("#bg-ten" ).click(function(){207 jQuery("body" ).removeClass("bg1");208 jQuery("body" ).removeClass("bg2");209 jQuery("body" ).removeClass("bg3");210 jQuery("body" ).removeClass("bg4");211 jQuery("body" ).removeClass("bg5");212 jQuery("body" ).removeClass("bg6");213 jQuery("body" ).removeClass("bg7");214 jQuery("body" ).removeClass("bg8");215 jQuery("body" ).removeClass("bg9");216 jQuery("body" ).addClass("bg10");217 });218 jQuery("#bg-one, #bg-two, #bg-three, #bg-four, #bg-five, #bg-six, #bg-seven, #bg-eight, #bg-nine, #bg-ten").click(function(){219 jQuery("#wrapper").addClass("boxed-layout");220 });221 jQuery("#wide").click(function(){222 jQuery("body").removeClass("bg1 bg2 bg3 bg4 bg5 bg6 bg7 bg8 bg9 bg10");223 });224 225 226 jQuery("#light").click(function(){227 jQuery("#footer").addClass("light");228 jQuery("#footer").removeClass("dark");229 jQuery("#footer img" ).attr("src", "images/footer-logo.jpg");230 });231 jQuery("#dark").click(function(){232 jQuery("#footer").addClass("dark");233 jQuery("#footer").removeClass("light");234 jQuery("#footer img" ).attr("src", "images/footer-logo-dark.jpg");235 });236 237 jQuery("#header-n").click(function(){238 jQuery("body").removeClass("fixed-header");239 });240 jQuery("#header-f").click(function(){241 jQuery("body").addClass("fixed-header");242 });243 244 245 246 // picker buttton247 jQuery(".picker_close").click(function(){248 249 jQuery("#choose_color").toggleClass("position");250 251 });252 253 254 ...

Full Screen

Full Screen

burger.js

Source:burger.js Github

copy

Full Screen

1$(document).ready(function() {2 $('.burger').click(function () {3 $('.burgerlist').toggleClass('active')4 })5 $('.store1').click(function () {6 $('.store1').toggleClass('active')7 $('.store2').removeClass('active')8 $('.store3').removeClass('active')9 $('.store4').removeClass('active')10 $('.store5').removeClass('active')11 $('.store6').removeClass('active')12 $('.store7').removeClass('active')13 $('.store8').removeClass('active')14 $('.store9').removeClass('active')15 $('.store10').removeClass('active')16 $('.store11').removeClass('active')17 })18 $('.store2').click(function () {19 $('.store2').toggleClass('active')20 $('.store1').removeClass('active')21 $('.store3').removeClass('active')22 $('.store4').removeClass('active')23 $('.store5').removeClass('active')24 $('.store6').removeClass('active')25 $('.store7').removeClass('active')26 $('.store8').removeClass('active')27 $('.store9').removeClass('active')28 $('.store10').removeClass('active')29 $('.store11').removeClass('active')30 })31 $('.store3').click(function () {32 $('.store3').toggleClass('active')33 $('.store2').removeClass('active')34 $('.store1').removeClass('active')35 $('.store4').removeClass('active')36 $('.store5').removeClass('active')37 $('.store6').removeClass('active')38 $('.store7').removeClass('active')39 $('.store8').removeClass('active')40 $('.store9').removeClass('active')41 $('.store10').removeClass('active')42 $('.store11').removeClass('active')43 })44 $('.store4').click(function () {45 $('.store4').toggleClass('active')46 $('.store2').removeClass('active')47 $('.store3').removeClass('active')48 $('.store1').removeClass('active')49 $('.store5').removeClass('active')50 $('.store6').removeClass('active')51 $('.store7').removeClass('active')52 $('.store8').removeClass('active')53 $('.store9').removeClass('active')54 $('.store10').removeClass('active')55 $('.store11').removeClass('active')56 })57 $('.store5').click(function () {58 $('.store5').toggleClass('active')59 $('.store2').removeClass('active')60 $('.store3').removeClass('active')61 $('.store4').removeClass('active')62 $('.store1').removeClass('active')63 $('.store6').removeClass('active')64 $('.store7').removeClass('active')65 $('.store8').removeClass('active')66 $('.store9').removeClass('active')67 $('.store10').removeClass('active')68 $('.store11').removeClass('active')69 })70 $('.store6').click(function () {71 $('.store6').toggleClass('active')72 $('.store2').removeClass('active')73 $('.store3').removeClass('active')74 $('.store4').removeClass('active')75 $('.store5').removeClass('active')76 $('.store1').removeClass('active')77 $('.store7').removeClass('active')78 $('.store8').removeClass('active')79 $('.store9').removeClass('active')80 $('.store10').removeClass('active')81 $('.store11').removeClass('active')82 })83 $('.store7').click(function () {84 $('.store7').toggleClass('active')85 $('.store2').removeClass('active')86 $('.store3').removeClass('active')87 $('.store4').removeClass('active')88 $('.store5').removeClass('active')89 $('.store6').removeClass('active')90 $('.store1').removeClass('active')91 $('.store8').removeClass('active')92 $('.store9').removeClass('active')93 $('.store10').removeClass('active')94 $('.store11').removeClass('active')95 })96 $('.store8').click(function () {97 $('.store8').toggleClass('active')98 $('.store2').removeClass('active')99 $('.store3').removeClass('active')100 $('.store4').removeClass('active')101 $('.store5').removeClass('active')102 $('.store6').removeClass('active')103 $('.store7').removeClass('active')104 $('.store1').removeClass('active')105 $('.store9').removeClass('active')106 $('.store10').removeClass('active')107 $('.store11').removeClass('active')108 })109 $('.store9').click(function () {110 $('.store9').toggleClass('active')111 $('.store2').removeClass('active')112 $('.store3').removeClass('active')113 $('.store4').removeClass('active')114 $('.store5').removeClass('active')115 $('.store6').removeClass('active')116 $('.store7').removeClass('active')117 $('.store8').removeClass('active')118 $('.store1').removeClass('active')119 $('.store10').removeClass('active')120 $('.store11').removeClass('active')121 })122 $('.store10').click(function () {123 $('.store10').toggleClass('active')124 $('.store2').removeClass('active')125 $('.store3').removeClass('active')126 $('.store4').removeClass('active')127 $('.store5').removeClass('active')128 $('.store6').removeClass('active')129 $('.store7').removeClass('active')130 $('.store8').removeClass('active')131 $('.store9').removeClass('active')132 $('.store1').removeClass('active')133 $('.store11').removeClass('active')134 })135 $('.store11').click(function () {136 $('.store11').toggleClass('active')137 $('.store2').removeClass('active')138 $('.store3').removeClass('active')139 $('.store4').removeClass('active')140 $('.store5').removeClass('active')141 $('.store6').removeClass('active')142 $('.store7').removeClass('active')143 $('.store8').removeClass('active')144 $('.store9').removeClass('active')145 $('.store10').removeClass('active')146 $('.store1').removeClass('active')147 })148 $('.pay1').click(function () {149 $('.pay1').toggleClass('active')150 })151 $('.pay2').click(function () {152 $('.pay2').toggleClass('active')153 })154 $('.pay3').click(function () {155 $('.pay3').toggleClass('active')156 })157 $('.pay4').click(function () {158 $('.pay4').toggleClass('active')159 })160 $('.pay5').click(function () {161 $('.pay5').toggleClass('active')162 })163 $('.pay6').click(function () {164 $('.pay6').toggleClass('active')165 })166 $('.pay7').click(function () {167 $('.pay7').toggleClass('active')168 })169 $('.pay8').click(function () {170 $('.pay8').toggleClass('active')171 })172 $('.pay9').click(function () {173 $('.pay9').toggleClass('active')174 })175 $('.pay10').click(function () {176 $('.pay10').toggleClass('active')177 })178 $('.pay11').click(function () {179 $('.pay11').toggleClass('active')180 })181 $('.pay12').click(function () {182 $('.pay12').toggleClass('active')183 })...

Full Screen

Full Screen

main.js

Source:main.js Github

copy

Full Screen

1 jQuery(document).ready(function( $ ) {2 3 'use strict';4 5 if ($(window).width() < 960 && $(window).load()) {6 //$("li.nolinks").children("a").attr('href', "javascript:void(0)");7 }8 9 if($('.top-bar').length>0)10 var t = $('.top-bar').height();11 else t=0;12 $('.header-section .arrow-first').click(function(e){13 14 e.preventDefault();15 e.stopPropagation();16 if($(this).parents().hasClass('hover')){17 $(this).parents().removeClass("hover");18 }else{19 $(this).parents().addClass("hover");20 }21 }); 22 23 $('.header-section .arrow-second').click(function(e){24 25 e.preventDefault();26 e.stopPropagation();27 if($(this).parents('li.sublinks').hasClass('hover')){28 $(this).parents('li.sublinks').removeClass("hover");29 }else{30 $(this).parents('li.sublinks').addClass("hover");31 }32 }); 33 34 $('.search-parent > a').click(function(){35 if($(this).parent().hasClass('active')){36 $(this).parent().removeClass("active");37 }else{38 $(this).parent().addClass("active");39 }40 $('.cart-parent').removeClass("active");41 $('#menu').removeClass("in");42 });43 $('.cart-parent > a').click(function(){44 if($(this).parent().hasClass('active')){45 $(this).parent().removeClass("active");46 }else{47 $(this).parent().addClass("active");48 }49 $('.search-parent').removeClass("active");50 $('#menu').removeClass("in");51 });52 $('.close-btn').click(function(){53 $('.search-parent').removeClass("active");54 $('#menu li').removeClass("hover");55 $('.cart-parent').removeClass("active");56 });57 $('.menu-icon').click(function(){58 $('.search-parent').removeClass("active");59 $('.cart-parent').removeClass("active");60 })61 $('#menu li').click(function(){62 if($(window).width()<1001){63 $('.search-parent').removeClass("active");64 $('.cart-parent').removeClass("active");65 }66 });67 var k=0;68 $(window).scroll(function(){69 if($(window).width()>1000){70 if($(window).scrollTop()>200+t){71 $('.header-section').removeAttr('style').addClass('pin');72 }else{73 $('.header-section').css({top:-$(window).scrollTop()}).removeClass('pin');74 }if($(window).scrollTop()>150+t){75 $('.header-section').addClass('before');76 }else{77 $('.header-section').removeClass('before');78 }79 }else{80 //$('.header-section').css({top:$(window).scrollTop()})81 if($(window).scrollTop()<k){82 $('.header-section').addClass('off').removeClass('woff').removeAttr('style');83 $('#menu').removeClass('in');84 $('.search-parent').removeClass('active');85 $('.cart-parent').removeClass('active');86 k=0;87 }88 }89 if($(window).scrollTop()>t){90 if(!$('.header-section').hasClass('woff')){91 $('.header-section').addClass('pin-start').addClass('off');92 }93 }else{94 $('.header-section').removeClass('pin-start').removeClass('off');95 }96 });97 if($(window).scrollTop()>150+t){98 $('.header-section').addClass('pin');99 }else{100 $('.header-section').removeAttr('style').removeClass('pin');101 }102 $(window).resize(function(){103 if($(window).width()>1000){104 $('.header-section').removeAttr('style');105 }106 });107 if($(window).scrollTop()>t){108 $('.header-section').addClass('off').addClass('pin-start');109 }else{110 $('.header-section').removeClass('off').removeClass('pin-start');111 }112 $('.menu-icon').click(function(){113 if($('#menu').hasClass('in')){114 $('.header-section').addClass('off').removeClass('woff').removeAttr('style');115 if($(window).scrollTop()>t){116 if(!$('.header-section').hasClass('woff')){117 $('.header-section').addClass('pin-start').addClass('off');118 }119 }else{120 $('.header-section').removeClass('pin-start').removeClass('off');121 }122 }else{123 k=$(window).scrollTop();124 $('.header-section').removeClass('off').addClass('woff').css({top:$(window).scrollTop()});125 }126 })127 $('.cart-parent >a').click(function(){128 if($(window).width()<1001){129 if(!$('.cart-parent').hasClass('active')){130 $('.header-section').addClass('off').removeClass('woff').removeAttr('style');131 if($(window).scrollTop()>t){132 if(!$('.header-section').hasClass('woff')){133 $('.header-section').addClass('pin-start').addClass('off');134 }135 }else{136 $('.header-section').removeClass('pin-start').removeClass('off');137 }138 }else{139 k=$(window).scrollTop();140 $('.header-section').removeClass('off').addClass('woff').css({top:$(window).scrollTop()});141 }142 }143 })144 $('.search-parent >a').click(function(){145 if($(window).width()<1001){146 if(!$('.search-parent').hasClass('active')){147 $('.header-section').addClass('off').removeClass('woff').removeAttr('style');148 if($(window).scrollTop()>t){149 if(!$('.header-section').hasClass('woff')){150 $('.header-section').addClass('pin-start').addClass('off');151 }152 }else{153 $('.header-section').removeClass('pin-start').removeClass('off');154 }155 }else{156 k=$(window).scrollTop();157 $('.header-section').removeClass('off').addClass('woff').css({top:$(window).scrollTop()});158 }159 }160 })161 ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { storiesOf } from '@storybook/react';2import { action } from '@storybook/addon-actions';3import { linkTo } from '@storybook/addon-links';4import { remove } from 'storybook-root-saga';5storiesOf('Button', module)6 .add('with text', () => (7 <button onClick={action('clicked')}>Hello Button</button>8 .add('with some emoji', () => (9 <button onClick={action('clicked')}>πŸ˜€ 😎 πŸ‘ πŸ’―</button>10 .add('with some emoji and action link', () => (11 <button onClick={linkTo('Button', 'with some emoji')}>πŸ˜€ 😎 πŸ‘ πŸ’―</button>12 ));13remove('Button', 'with some emoji and action link');14import { configure } from '@storybook/react';15import { rootSaga } from './test.js';16function loadStories() {17 require('../stories/index.js');18 require('../stories/test.js');19}20configure(loadStories, module);21import { configure } from '@storybook/react';22import { rootSaga } from './test.js';23function loadStories() {24 require('../stories/index.js');25 require('../stories/test.js');26}27configure(loadStories, module, rootSaga);

Full Screen

Using AI Code Generation

copy

Full Screen

1import { storiesOf } from '@storybook/react';2import { action } from '@storybook/addon-actions';3import { linkTo } from '@storybook/addon-links';4import { remove } from 'storybook-root-saga';5storiesOf('Button', module)6 .add('with text', () => (7 <button onClick={action('clicked')}>Hello Button</button>8 .add('with some emoji', () => (9 <button onClick={action('clicked')}>πŸ˜€ 😎 πŸ‘ πŸ’―</button>10 .add('with some emoji and action link', () => (11 <button onClick={linkTo('Button', 'with some emoji')}>πŸ˜€ 😎 πŸ‘ πŸ’―</button>12 ));13remove('Button', 'with some emoji and action link');14import { configure } from '@storybook/react';15import { rootSaga } from './test.js';16function loadStories() {17 require('../stories/index.js');18 require('../stories/test.js');19}20configure(loadStories, module);21import { configure } from '@storybook/react';22import { rootSaga } from './test.js';23function loadStories() {24 require('../stories/index.js');25 require('../stories/test.js');26}27configure(loadStories, module, rootSaga);

Full Screen

Using AI Code Generation

copy

Full Screen

1import { remove } from 'storybook-root';2import { add } from 'storybook-root';3import { update } from 'storybook-root';4import { get } from 'storybook-root';5import { getAll } from 'storybook-root';6import { getRoot } from 'storybook-root';7import { getStory } from 'storybook-root';8import { getStories } from 'storybook-root';9import { getStorybook } from 'storybook-root';10import { getStorybookUI } from 'storybook-root';11import { getStorybookUIParams } from 'storybook-root';12import { getStorybookUIOptions } from 'storybook-root';13import { getStorybookUIRoot } from 'storybook-root';14import { getStorybookUIRootProps } from 'storybook-root';15import { getStorybookUIRootParams } from 'storybook-root';16import { getStorybookUIRootOptions } from 'storybook-root';17import { getStorybookUIRootProps } from 'storybook-root';18import { getStorybookUIRootParams } from 'storybook-root';19import { getStorybookUIRootOptions } from 'storybook-root';20import { getStorybookUIRootProps } from 'storybook

Full Screen

Using AI Code Generation

copy

Full Screen

1import {remove} from 'storybook-root';2remove('storyName');3import {remove} from 'storybook-root';4remove('storyName');5import {remove} from 'storybook-root';6remove('storyName');7import {remove} from 'storybook-root';8remove('storyName');9import {remove} from 'storybook-root';10remove('storyName');

Full Screen

Using AI Code Generation

copy

Full Screen

1import { remove } from 'storybook-root';2remove('my-storybook');3import { add } from 'storybook-root';4add('my-storybook', 'my-storybook-root');5import { get } from 'storybook-root';6get('my-storybook');7import { getAll } from 'storybook-root';8getAll();9import { storiesOf } from '@storybook/react';10import { withKnobs, text } from '@storybook/addon-knobs';11import { withRoot } from 'storybook-root';12const stories = storiesOf('my-storybook', module);13stories.addDecorator(withKnobs);14stories.addDecorator(withRoot('my-storybook-root'));15stories.add('my-storybook', () => {16 const name = text('Name', 'John Doe');17 return <div>Hello {name}</div>;18});19import { storiesOf } from '@storybook/react';20import { withKnobs, text } from '@storybook/addon-knobs';21import { withRoot } from 'storybook-root';22const stories = storiesOf('my-storybook', module);23stories.addDecorator(withKnobs);24stories.addDecorator(withRoot('my-storybook-root'));25stories.add('my-storybook', () => {26 const name = text('Name', 'John Doe');27 return <div>Hello {name}</div>;28});29import { storiesOf } from '@storybook/react';30import { withKnobs, text } from '@storybook/addon-knobs';31import { withRoot } from 'storybook-root';32const stories = storiesOf('my-storybook', module);33stories.addDecorator(withKnobs);34stories.addDecorator(withRoot('my-storybook-root'));35stories.add('my-storybook', () => {36 const name = text('Name', 'John Doe');37 return <div>Hello {name}</div>;38});39import { storiesOf } from '@storybook/react';40import { withKnobs, text } from '@storybook/addon-knobs';41import { withRoot } from 'storybook-root';42const stories = storiesOf('my-storybook', module);43stories.addDecorator(withKnobs);44stories.addDecorator(with of storybook-root45import {remove} from 'storybook-root';46remove('storyName');47import {remove} from 'storybook-root';48remove('storyName');49import {remove} from 'storybook-root';50remove('storyName');51import {remove} from 'storybook-root';52remove('storyName');53import {remove} from 'storybook-root';54remove('storyName');55import {remove} from 'storybook-root';56remove('storyName');57import {remove} from 'storybook-root';58remove('storyName');

Full Screen

Using AI Code Generation

copy

Full Screen

1imrt StorybookRootSibling from 'torybook-root-sbling';2cons sibling = new StbookRootSibling(<View style={{backgroundColor: 'red', height: 100}} />);3setTimeout(() => {4 sibling.remove();5}, 3000);6setTimeout(() => {7 siblingupdate(<View style={{backgroundColor: 'green', height: 100}} />);8}, 5000);9setTimeout(() => {10 sibling.remove();11}, 7000);12setTimeout(() => {13 sibling.update(<View style={{backgroundColor: 'blue', height: 100}} />);14}, 9000);15setTimeout(() => {16 sibling.remove();17}, 11000);18setTimeout(() => {19 sibling.update(<View style={{backgroundColor: 'yellow', height: 100}} />);20}, 13000);21setTimeout(() => {22 sibling.remove();23}, 15000);24setTimeout(() => {25 sibling.update(<View style={{backgroundColor: 'black', height: 100}} />);26}, 17000);27setTimeout(() => {28 sibling.remove();29}, 19000);30setTimeout(() => {31 sibling.update(<View style={{backgroundColor: 'white', height: 100}} />);32}, 21000);33setTimeout(() => {34 sibling.remove();35}, 23000);36setTimeout(() => {37 sibling.update(<View style={{backgroundColor: 'cyan', height: 100}} />);38}, 25000);39setTimeout(() => {40 sibling.remove();41}, 27000);42setTimeout(() => {43 sibling.update(<View style={{backgroundColor: 'magenta', height: 100}} />);44}, 29000);45setTimeout(() => {46 sibling.remove();47}, 31000);48get('my-storybook');49import { getAll } from 'storybook-root';50getAll();51import { storiesOf } from '@storybook/react';52import { withKnobs, text } from '@storybook/addon-knobs';53import { withRoot } from 'storybook-root';54const stories = storiesOf('my-storybook', module);55stories.addDecorator(withKnobs);56stories.addDecorator(withRoot('my-storybook-root'));57stories.add('my-storybook', () => {58 const name = text('Name', 'John Doe');59 return <div>Hello {name}</div>;60});61import { storiesOf } from '@storybook/react';62import { withKnobs, text } from '@storybook/addon-knobs';63import { withRoot } from 'storybook-root';64const stories = storiesOf('my-storybook', module);65stories.addDecorator(withKnobs);66stories.addDecorator(withRoot('my-storybook-root'));67stories.add('my-storybook', () => {68 const name = text('Name', 'John Doe');69 return <div>Hello {name}</div>;70});71import { storiesOf } from '@storybook/react';72import { withKnobs, text } from '@storybook/addon-knobs';73import { withRoot } from 'storybook-root';74const stories = storiesOf('my-storybook', module);75stories.addDecorator(withKnobs);76stories.addDecorator(withRoot('my-storybook-root'));77stories.add('my-storybook', () => {78 const name = text('Name', 'John Doe');79 return <div>Hello {name}</div>;80});81import { storiesOf } from '@storybook/react';82import { withKnobs, text } from '@storybook/addon-knobs';83import { withRoot } from 'storybook-root';84const stories = storiesOf('my-storybook', module);85stories.addDecorator(withKnobs);86stories.addDecorator(with

Full Screen

Using AI Code Generation

copy

Full Screen

1import { remove } from 'react-native-root-sibling';2export default function () {3 remove(1);4}5import { remove } from 'react-native-root-sibling';6describe('test remove method', () => {7 it('should remove the sibling', () => {8 const sibling = remove(1);9 expect(sibling).toBeUndefined();10 });11});12import { remove } from 'react-native-root-sibling';13export default {14 remove: jest.fn(),15};16module.exports = {17 moduleNameMapper: {18 '^react-native/(.*)$': 'react-native-web/$1',19 },20};

Full Screen

Using AI Code Generation

copy

Full Screen

1import { remove } from 'storybook-root';2const someComponent = () => {3 return (4 );5};6remove(someComponent);7import { add } from 'storybook-root';8const someComponent = () => {9 return (10 );11};12add(someComponent);13import { add } from 'storybook-root';14const someComponent = () => {15 return (16 );17};18add(someComponent);19import { add } from 'storybook-root';20const someComponent = () => {21 return (22 );23};24add(someComponent);25import { add } from 'storybook-root';26const someComponent = () => {27 return (28 );29};30add(someComponent);31import { add } from 'storybook-root';32const someComponent = () => {33 return (34 );35};36add(someComponent);37import { add } from 'storybook-root';38const someComponent = () => {39 return (40 );41};42add(someComponent);43import { add } from 'storybook-root';44const someComponent = () => {45 return (46 );47};48add(someComponent);49import { add } from 'storybook-root';50const someComponent = () => {51 return (52 );53};54add(someComponent);55import { add }

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 storybook-root 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