Best Python code snippet using pyatom_python
businessActions.test.js
Source:businessActions.test.js
...23 type: actionTypes.MAKE_PAPERCLIP24 }25 ];26 store.dispatch(Actions.makePaperclip());27 expect(store.getActions()).toEqual(expectedActions);28 expect(store.getActions()).toMatchSnapshot();29 });30 it('Dispatches the correct action and payload (updateFunds)', () => {31 const expectedActions = [32 {33 type: actionTypes.UPDATE_FUNDS,34 value: 535 }36 ];37 store.dispatch(Actions.updateFunds(5));38 expect(store.getActions()).toEqual(expectedActions);39 expect(store.getActions()).toMatchSnapshot();40 });41 it('Dispatches the correct action and payload (checkButtons)', () => {42 const expectedActions = [43 {44 type: actionTypes.CHECK_BUTTONS45 }46 ];47 store.dispatch(Actions.checkButtons());48 expect(store.getActions()).toEqual(expectedActions);49 expect(store.getActions()).toMatchSnapshot();50 });51 it('Dispatches the correct action and payload (sellPaperclips)', () => {52 const expectedActions = [53 {54 type: actionTypes.START_SELLING55 }56 ];57 store.dispatch(Actions.sellPaperclips());58 expect(store.getActions()).toEqual(expectedActions);59 expect(store.getActions()).toMatchSnapshot();60 });61 it('Dispatches the correct action and payload (startUpdatingUnsoldInventory)', () => {62 const expectedActions = [63 {64 type: actionTypes.START_UPDATING_UNSOLD_INVENTORY65 }66 ];67 store.dispatch(Actions.startUpdatingUnsoldInventory());68 expect(store.getActions()).toEqual(expectedActions);69 expect(store.getActions()).toMatchSnapshot();70 });71 it('Dispatches the correct action and payload (stopUpdatingUnsoldInventory)', () => {72 const expectedActions = [73 {74 type: actionTypes.STOP_UPDATING_UNSOLD_INVENTORY75 }76 ];77 store.dispatch(Actions.stopUpdatingUnsoldInventory());78 expect(store.getActions()).toEqual(expectedActions);79 expect(store.getActions()).toMatchSnapshot();80 });81 it('Dispatches the correct action and payload (updateUnsoldInventory)', () => {82 const expectedActions = [83 {84 type: actionTypes.UPDATE_UNSOLD_INVENTORY85 }86 ];87 store.dispatch(Actions.updateUnsoldInventory());88 expect(store.getActions()).toEqual(expectedActions);89 expect(store.getActions()).toMatchSnapshot();90 });91 it('Dispatches the correct action and payload (lowerPrice)', () => {92 const expectedActions = [93 {94 type: actionTypes.LOWER_PRICE95 }96 ];97 store.dispatch(Actions.lowerPrice());98 expect(store.getActions()).toEqual(expectedActions);99 expect(store.getActions()).toMatchSnapshot();100 });101 it('Dispatches the correct action and payload (raisePrice)', () => {102 const expectedActions = [103 {104 type: actionTypes.RAISE_PRICE105 }106 ];107 store.dispatch(Actions.raisePrice());108 expect(store.getActions()).toEqual(expectedActions);109 expect(store.getActions()).toMatchSnapshot();110 });111 it('Dispatches the correct action and payload (updatePublicDemand)', () => {112 const expectedActions = [113 {114 type: actionTypes.UPDATE_PUBLIC_DEMAND115 }116 ];117 store.dispatch(Actions.updatePublicDemand());118 expect(store.getActions()).toEqual(expectedActions);119 expect(store.getActions()).toMatchSnapshot();120 });121 it('Dispatches the correct action and payload (toggleMarketingButton)', () => {122 const expectedActions = [123 {124 type: actionTypes.TOGGLE_MARKETING_BUTTON125 }126 ];127 store.dispatch(Actions.toggleMarketingButton());128 expect(store.getActions()).toEqual(expectedActions);129 expect(store.getActions()).toMatchSnapshot();130 });131 132 it('Dispatches the correct action and payload (marketing)', () => {133 const expectedActions = [134 {135 type: actionTypes.MARKETING136 }137 ];138 store.dispatch(Actions.marketing());139 expect(store.getActions()).toEqual(expectedActions);140 expect(store.getActions()).toMatchSnapshot();141 });142 it('Dispatches the correct action and payload (marketingNextLevel)', () => {143 const expectedActions = [144 {145 type: actionTypes.MARKETING_NEXT_LEVEL146 }147 ];148 store.dispatch(Actions.marketingNextLevel());149 expect(store.getActions()).toEqual(expectedActions);150 expect(store.getActions()).toMatchSnapshot();151 });152 it('Dispatches the correct action and payload (updateMaxPublicDemand)', () => {153 const expectedActions = [154 {155 type: actionTypes.UPDATE_MAX_PUBLIC_DEMAND156 }157 ];158 store.dispatch(Actions.updateMaxPublicDemand());159 expect(store.getActions()).toEqual(expectedActions);160 expect(store.getActions()).toMatchSnapshot();161 });162 it('Dispatches the correct action and payload (startBuyingWire)', () => {163 const expectedActions = [164 {165 type: actionTypes.START_BUYING_WIRE166 }167 ];168 store.dispatch(Actions.startBuyingWire());169 expect(store.getActions()).toEqual(expectedActions);170 expect(store.getActions()).toMatchSnapshot();171 });172 it('Dispatches the correct action and payload (buyWire)', () => {173 const expectedActions = [174 {175 type: actionTypes.BUY_WIRE176 }177 ];178 store.dispatch(Actions.buyWire());179 expect(store.getActions()).toEqual(expectedActions);180 expect(store.getActions()).toMatchSnapshot();181 });182 it('Dispatches the correct action and payload (randomWirePrice)', () => {183 const expectedActions = [184 {185 type: actionTypes.RANDOM_WIRE_PRICE,186 value: 15187 }188 ];189 store.dispatch(Actions.randomWirePrice(15));190 expect(store.getActions()).toEqual(expectedActions);191 expect(store.getActions()).toMatchSnapshot();192 });193 it('Dispatches the correct action and payload (toggleWireButton)', () => {194 const expectedActions = [195 {196 type: actionTypes.TOGGLE_WIRE_BUTTON197 }198 ];199 store.dispatch(Actions.toggleWireButton());200 expect(store.getActions()).toEqual(expectedActions);201 expect(store.getActions()).toMatchSnapshot();202 });203 it('Dispatches the correct action and payload (checkExistenceOfWire)', () => {204 const expectedActions = [205 {206 type: actionTypes.CHECK_EXISTENCE_OF_WIRE207 }208 ];209 store.dispatch(Actions.checkExistenceOfWire());210 expect(store.getActions()).toEqual(expectedActions);211 expect(store.getActions()).toMatchSnapshot();212 });213 it('Dispatches the correct action and payload (stop)', () => {214 const expectedActions = [215 {216 type: actionTypes.STOP217 }218 ];219 store.dispatch(Actions.stop());220 expect(store.getActions()).toEqual(expectedActions);221 expect(store.getActions()).toMatchSnapshot();222 });223 it('Dispatches the correct action and payload (wireExists)', () => {224 const expectedActions = [225 {226 type: actionTypes.WIRE_EXISTS,227 val: true228 }229 ];230 store.dispatch(Actions.wireExists(true));231 expect(store.getActions()).toEqual(expectedActions);232 expect(store.getActions()).toMatchSnapshot();233 });234 it('Dispatches the correct action and payload (autoPaperclips)', () => {235 const expectedActions = [236 {237 type: actionTypes.AUTO_PAPERCLIPS238 }239 ];240 store.dispatch(Actions.autoPaperclips());241 expect(store.getActions()).toEqual(expectedActions);242 expect(store.getActions()).toMatchSnapshot();243 });244 it('Dispatches the correct action and payload (autoPaperclipsStart)', () => {245 const expectedActions = [246 {247 type: actionTypes.AUTO_PAPERCLIPS_START248 }249 ];250 store.dispatch(Actions.autoPaperclipsStart());251 expect(store.getActions()).toEqual(expectedActions);252 expect(store.getActions()).toMatchSnapshot();253 });254 it('Dispatches the correct action and payload (autoClippersAddOne)', () => {255 const expectedActions = [256 {257 type: actionTypes.AUTO_CLIPPERS_ADD_ONE258 }259 ];260 store.dispatch(Actions.autoClippersAddOne());261 expect(store.getActions()).toEqual(expectedActions);262 expect(store.getActions()).toMatchSnapshot();263 });264 it('Dispatches the correct action and payload (setAutoClipperInitPrice)', () => {265 const expectedActions = [266 {267 type: actionTypes.SET_AUTO_CLIPPER_INIT_PRICE268 }269 ];270 store.dispatch(Actions.setAutoClipperInitPrice());271 expect(store.getActions()).toEqual(expectedActions);272 expect(store.getActions()).toMatchSnapshot();273 });274 it('Dispatches the correct action and payload (toggleAutoClippersButton)', () => {275 const expectedActions = [276 {277 type: actionTypes.TOGGLE_AUTO_CLIPPERS_BUTTON278 }279 ];280 store.dispatch(Actions.toggleAutoClippersButton());281 expect(store.getActions()).toEqual(expectedActions);282 expect(store.getActions()).toMatchSnapshot();283 });284 it('Dispatches the correct action and payload (toggleMegaClippersButton)', () => {285 const expectedActions = [286 {287 type: actionTypes.TOGGLE_MEGA_CLIPPERS_BUTTON288 }289 ];290 store.dispatch(Actions.toggleMegaClippersButton());291 expect(store.getActions()).toEqual(expectedActions);292 expect(store.getActions()).toMatchSnapshot();293 });294 it('Dispatches the correct action and payload (trustPlusOne)', () => {295 const expectedActions = [296 {297 type: actionTypes.TRUST_PLUS_ONE298 }299 ];300 store.dispatch(Actions.trustPlusOne());301 expect(store.getActions()).toEqual(expectedActions);302 expect(store.getActions()).toMatchSnapshot();303 });304 it('Dispatches the correct action and payload (trustPlusOneFromProject)', () => {305 const expectedActions = [306 {307 type: actionTypes.TRUST_PLUS_ONE_FROM_PROJECT,308 val: 3309 }310 ];311 store.dispatch(Actions.trustPlusOneFromProject(3));312 expect(store.getActions()).toEqual(expectedActions);313 expect(store.getActions()).toMatchSnapshot();314 });315 it('Dispatches the correct action and payload (increaseOps)', () => {316 const expectedActions = [317 {318 type: actionTypes.INCREASE_OPS319 }320 ];321 store.dispatch(Actions.increaseOps());322 expect(store.getActions()).toEqual(expectedActions);323 expect(store.getActions()).toMatchSnapshot();324 });325 it('Dispatches the correct action and payload (startDecreasingOperations)', () => {326 const expectedActions = [327 {328 type: actionTypes.START_DECREASING_OPERATIONS329 }330 ];331 store.dispatch(Actions.startDecreasingOperations());332 expect(store.getActions()).toEqual(expectedActions);333 expect(store.getActions()).toMatchSnapshot();334 });335 it('Dispatches the correct action and payload (startDecreasingOps)', () => {336 const expectedActions = [337 {338 type: actionTypes.START_DECREASING_OPS339 }340 ];341 store.dispatch(Actions.startDecreasingOps());342 expect(store.getActions()).toEqual(expectedActions);343 expect(store.getActions()).toMatchSnapshot();344 });345 it('Dispatches the correct action and payload (stopDecreasingOps)', () => {346 const expectedActions = [347 {348 type: actionTypes.STOP_DECREASING_OPERATIONS349 }350 ];351 store.dispatch(Actions.stopDecreasingOps());352 expect(store.getActions()).toEqual(expectedActions);353 expect(store.getActions()).toMatchSnapshot();354 });355 it('Dispatches the correct action and payload (decreaseOps)', () => {356 const expectedActions = [357 {358 type: actionTypes.DECREASE_OPS359 }360 ];361 store.dispatch(Actions.decreaseOps());362 expect(store.getActions()).toEqual(expectedActions);363 expect(store.getActions()).toMatchSnapshot();364 });365 it('Dispatches the correct action and payload (increaseProcessors)', () => {366 const expectedActions = [367 {368 type: actionTypes.INCREASE_PROCESSORS369 }370 ];371 store.dispatch(Actions.increaseProcessors());372 expect(store.getActions()).toEqual(expectedActions);373 expect(store.getActions()).toMatchSnapshot();374 });375 it('Dispatches the correct action and payload (increaseProcessorsMemory)', () => {376 const expectedActions = [377 {378 type: actionTypes.INCREASE_PROCESSORS_MEMORY379 }380 ];381 store.dispatch(Actions.increaseProcessorsMemory());382 expect(store.getActions()).toEqual(expectedActions);383 expect(store.getActions()).toMatchSnapshot();384 });385 it('Dispatches the correct action and payload (increaseCreativity)', () => {386 const expectedActions = [387 {388 type: actionTypes.INCREASE_CREATIVITY389 }390 ];391 store.dispatch(Actions.increaseCreativity());392 expect(store.getActions()).toEqual(expectedActions);393 expect(store.getActions()).toMatchSnapshot();394 });395 it('Dispatches the correct action and payload (initProjects)', () => {396 const expectedActions = [397 {398 type: actionTypes.INIT_PROJECTS,399 card1: {a:1},400 card2: {a:2},401 card3: {a:3}402 }403 ];404 store.dispatch(Actions.initProjects({a:1},{a:2},{a:3}));405 expect(store.getActions()).toEqual(expectedActions);406 expect(store.getActions()).toMatchSnapshot();407 });408 it('Dispatches the correct action and payload (checkCardValidity)', () => {409 const expectedActions = [410 {411 type: actionTypes.CHECK_CARD_VALIDITY,412 cardId: "card1",413 valid: true,414 i: 0415 }416 ];417 store.dispatch(Actions.checkCardValidity("card1",true,0));418 expect(store.getActions()).toEqual(expectedActions);419 expect(store.getActions()).toMatchSnapshot();420 });421 it('Dispatches the correct action and payload (deleteCard)', () => {422 const expectedActions = [423 {424 type: actionTypes.DELETE_CARD,425 cardId: "card3"426 }427 ];428 store.dispatch(Actions.deleteCard("card3"));429 expect(store.getActions()).toEqual(expectedActions);430 expect(store.getActions()).toMatchSnapshot();431 });432 it('Dispatches the correct action and payload (showRevTracker)', () => {433 const expectedActions = [434 {435 type: actionTypes.SHOW_REV_TRACKER,436 price: 45437 }438 ];439 store.dispatch(Actions.showRevTracker(45));440 expect(store.getActions()).toEqual(expectedActions);441 expect(store.getActions()).toMatchSnapshot();442 });443 it('Dispatches the correct action and payload (addProject)', () => {444 const expectedActions = [445 {446 type: actionTypes.ADD_PROJECT,447 project: {b: 7}448 }449 ];450 store.dispatch(Actions.addProject({b: 7}));451 expect(store.getActions()).toEqual(expectedActions);452 expect(store.getActions()).toMatchSnapshot();453 });454 it('Dispatches the correct action and payload (removePriceOfProjectOps)', () => {455 const expectedActions = [456 {457 type: actionTypes.REMOVE_PRICE_OF_PROJECT_OPS,458 ops: 47459 }460 ];461 store.dispatch(Actions.removePriceOfProjectOps(47));462 expect(store.getActions()).toEqual(expectedActions);463 expect(store.getActions()).toMatchSnapshot();464 });465 it('Dispatches the correct action and payload (removePriceOfProjectCreat)', () => {466 const expectedActions = [467 {468 type: actionTypes.REMOVE_PRICE_OF_PROJECT_CREAT,469 creativity: 73470 }471 ];472 store.dispatch(Actions.removePriceOfProjectCreat(73));473 expect(store.getActions()).toEqual(expectedActions);474 expect(store.getActions()).toMatchSnapshot();475 });476 it('Dispatches the correct action and payload (removePriceOfProjectOpsAndCreat)', () => {477 const expectedActions = [478 {479 type: actionTypes.REMOVE_PRICE_OF_PROJECT_OPS_AND_CREAT,480 ops: 74,481 creativity: 25482 }483 ];484 store.dispatch(Actions.removePriceOfProjectOpsAndCreat(74, 25));485 expect(store.getActions()).toEqual(expectedActions);486 expect(store.getActions()).toMatchSnapshot();487 });488 it('Dispatches the correct action and payload (removePriceOfProjectTrust)', () => {489 const expectedActions = [490 {491 type: actionTypes.REMOVE_PRICE_OF_PROJECT_TRUST,492 trust: 67493 }494 ];495 store.dispatch(Actions.removePriceOfProjectTrust(67));496 expect(store.getActions()).toEqual(expectedActions);497 expect(store.getActions()).toMatchSnapshot();498 });499 it('Dispatches the correct action and payload (improveAutoClippers)', () => {500 const expectedActions = [501 {502 type: actionTypes.IMPROVE_AUTO_PAPER_CLIPPER,503 val: 17504 }505 ];506 store.dispatch(Actions.improveAutoClippers(17));507 expect(store.getActions()).toEqual(expectedActions);508 expect(store.getActions()).toMatchSnapshot();509 });510 it('Dispatches the correct action and payload (toggleMakePaperclipButton)', () => {511 const expectedActions = [512 {513 type: actionTypes.TOGGLE_MAKE_PAPERCLIP_BUTTON,514 val: true515 }516 ];517 store.dispatch(Actions.toggleMakePaperclipButton(true));518 expect(store.getActions()).toEqual(expectedActions);519 expect(store.getActions()).toMatchSnapshot();520 });521 it('Dispatches the correct action and payload (improveWireExtrusion)', () => {522 const expectedActions = [523 {524 type: actionTypes.IMPROVE_WIRE_EXTRUSION,525 val: 36526 }527 ];528 store.dispatch(Actions.improveWireExtrusion(36));529 expect(store.getActions()).toEqual(expectedActions);530 expect(store.getActions()).toMatchSnapshot();531 });532 it('Dispatches the correct action and payload (creativityTurnOn)', () => {533 const expectedActions = [534 {535 type: actionTypes.CREATIVITY_TURN_ON536 }537 ];538 store.dispatch(Actions.creativityTurnOn());539 expect(store.getActions()).toEqual(expectedActions);540 expect(store.getActions()).toMatchSnapshot();541 });542 it('Dispatches the correct action and payload (startImprovingMarketing)', () => {543 const expectedActions = [544 {545 type: actionTypes.START_IMPROVING_MARKETING,546 act: {a:5}547 }548 ];549 store.dispatch(Actions.startImprovingMarketing({a:5}));550 expect(store.getActions()).toEqual(expectedActions);551 expect(store.getActions()).toMatchSnapshot();552 });553 554 it('Dispatches the correct action and payload (improveMarketing)', () => {555 const expectedActions = [556 {557 type: actionTypes.IMPROVE_MARKETING,558 val: 46559 }560 ];561 store.dispatch(Actions.improveMarketing(46));562 expect(store.getActions()).toEqual(expectedActions);563 expect(store.getActions()).toMatchSnapshot();564 });565 it('Dispatches the correct action and payload (showInvestEngine)', () => {566 const expectedActions = [567 {568 type: actionTypes.SHOW_INVESTMENT_ENGINE,569 val: true570 }571 ];572 store.dispatch(Actions.showInvestEngine(true));573 expect(store.getActions()).toEqual(expectedActions);574 expect(store.getActions()).toMatchSnapshot();575 });576 it('Dispatches the correct action and payload (showStrategicModeling)', () => {577 const expectedActions = [578 {579 type: actionTypes.SHOW_STRATEGIC_MODELING,580 val: true581 }582 ];583 store.dispatch(Actions.showStrategicModeling(true));584 expect(store.getActions()).toEqual(expectedActions);585 expect(store.getActions()).toMatchSnapshot();586 });587 it('Dispatches the correct action and payload (sendCommentToTerminal)', () => {588 const expectedActions = [589 {590 type: actionTypes.SEND_COMMENT_TO_TERMINAL,591 comment: "Testing actions"592 }593 ];594 store.dispatch(Actions.sendCommentToTerminal("Testing actions"));595 expect(store.getActions()).toEqual(expectedActions);596 expect(store.getActions()).toMatchSnapshot();597 });598 it('Dispatches the correct action and payload (addNewStrategy)', () => {599 const expectedActions = [600 {601 type: actionTypes.ADD_NEW_STRATEGY,602 strategy: "New Strategy"603 }604 ];605 store.dispatch(Actions.addNewStrategy("New Strategy"));606 expect(store.getActions()).toEqual(expectedActions);607 expect(store.getActions()).toMatchSnapshot();608 });609 it('Dispatches the correct action and payload (toggleDropdownInvestments)', () => {610 const expectedActions = [611 {612 type: actionTypes.TOGGLE_DROPDOWN_INVESTMENTS613 }614 ];615 store.dispatch(Actions.toggleDropdownInvestments());616 expect(store.getActions()).toEqual(expectedActions);617 expect(store.getActions()).toMatchSnapshot();618 });619 it('Dispatches the correct action and payload (toggleDropdownStrategicModeling)', () => {620 const expectedActions = [621 {622 type: actionTypes.TOGGLE_DROPDOWN_STRATEGIC_MODELING623 }624 ];625 store.dispatch(Actions.toggleDropdownStrategicModeling());626 expect(store.getActions()).toEqual(expectedActions);627 expect(store.getActions()).toMatchSnapshot();628 });629 it('Dispatches the correct action and payload (closeDropdowns)', () => {630 const expectedActions = [631 {632 type: actionTypes.CLOSE_DROPDOWNS633 }634 ];635 store.dispatch(Actions.closeDropdowns());636 expect(store.getActions()).toEqual(expectedActions);637 expect(store.getActions()).toMatchSnapshot();638 });639 it('Dispatches the correct action and payload (showQuantumComputing)', () => {640 const expectedActions = [641 {642 type: actionTypes.SHOW_QUANTUM_COMPUTING,643 val: true644 }645 ];646 store.dispatch(Actions.showQuantumComputing(true));647 expect(store.getActions()).toEqual(expectedActions);648 expect(store.getActions()).toMatchSnapshot();649 });650 it('Dispatches the correct action and payload (showQuantCompMessage)', () => {651 const expectedActions = [652 {653 type: actionTypes.SHOW_QUANT_COMP_MESSAGE654 }655 ];656 store.dispatch(Actions.showQuantCompMessage());657 expect(store.getActions()).toEqual(expectedActions);658 expect(store.getActions()).toMatchSnapshot();659 });660 it('Dispatches the correct action and payload (addChip)', () => {661 const expectedActions = [662 {663 type: actionTypes.ADD_CHIP,664 obj: {c: 8}665 }666 ];667 store.dispatch(Actions.addChip({c: 8}));668 expect(store.getActions()).toEqual(expectedActions);669 expect(store.getActions()).toMatchSnapshot();670 });671 it('Dispatches the correct action and payload (toggleChip)', () => {672 const expectedActions = [673 {674 type: actionTypes.TOGGLE_CHIP,675 val: true,676 chipsNumber: "chipX"677 }678 ];679 store.dispatch(Actions.toggleChip(true, "chipX"));680 expect(store.getActions()).toEqual(expectedActions);681 expect(store.getActions()).toMatchSnapshot();682 });683 it('Dispatches the correct action and payload (changeToQOps)', () => {684 const expectedActions = [685 {686 type: actionTypes.CHANGE_TO_Q_OPS687 }688 ];689 store.dispatch(Actions.changeToQOps());690 expect(store.getActions()).toEqual(expectedActions);691 expect(store.getActions()).toMatchSnapshot();692 });693 it('Dispatches the correct action and payload (startAddingQOps)', () => {694 const expectedActions = [695 {696 type: actionTypes.START_ADDING_Q_OPS,697 chipsNumber: "chipX"698 }699 ];700 store.dispatch(Actions.startAddingQOps("chipX"));701 expect(store.getActions()).toEqual(expectedActions);702 expect(store.getActions()).toMatchSnapshot();703 });704 it('Dispatches the correct action and payload (addQOps)', () => {705 const expectedActions = [706 {707 type: actionTypes.ADD_Q_OPS,708 chipsNumber: "chipX"709 }710 ];711 store.dispatch(Actions.addQOps("chipX"));712 expect(store.getActions()).toEqual(expectedActions);713 expect(store.getActions()).toMatchSnapshot();714 });715 it('Dispatches the correct action and payload (stopAddingQOps)', () => {716 const expectedActions = [717 {718 type: actionTypes.STOP_ADDING_Q_OPS719 }720 ];721 store.dispatch(Actions.stopAddingQOps());722 expect(store.getActions()).toEqual(expectedActions);723 expect(store.getActions()).toMatchSnapshot();724 });725 it('Dispatches the correct action and payload (startSubtractingQOps)', () => {726 const expectedActions = [727 {728 type: actionTypes.START_SUBTRACTING_Q_OPS,729 chipsNumber: "chipX"730 }731 ];732 store.dispatch(Actions.startSubtractingQOps("chipX"));733 expect(store.getActions()).toEqual(expectedActions);734 expect(store.getActions()).toMatchSnapshot();735 });736 it('Dispatches the correct action and payload (subtractQOps)', () => {737 const expectedActions = [738 {739 type: actionTypes.SUBTRACT_Q_OPS,740 chipsNumber: "chipX"741 }742 ];743 store.dispatch(Actions.subtractQOps("chipX"));744 expect(store.getActions()).toEqual(expectedActions);745 expect(store.getActions()).toMatchSnapshot();746 });747 it('Dispatches the correct action and payload (stopSubtractingQOps)', () => {748 const expectedActions = [749 {750 type: actionTypes.STOP_SUBTRACTING_Q_OPS751 }752 ];753 store.dispatch(Actions.stopSubtractingQOps("chipX"));754 expect(store.getActions()).toEqual(expectedActions);755 expect(store.getActions()).toMatchSnapshot();756 });757 it('Dispatches the correct action and payload (captureCurrentQOps)', () => {758 const expectedActions = [759 {760 type: actionTypes.CAPTURE_CURRENT_Q_OPS,761 val: 276762 }763 ];764 store.dispatch(Actions.captureCurrentQOps(276));765 expect(store.getActions()).toEqual(expectedActions);766 expect(store.getActions()).toMatchSnapshot();767 });768 it('Dispatches the correct action and payload (updateOps)', () => {769 const expectedActions = [770 {771 type: actionTypes.UPDATE_OPS,772 val: 34773 }774 ];775 store.dispatch(Actions.updateOps(34));776 expect(store.getActions()).toEqual(expectedActions);777 expect(store.getActions()).toMatchSnapshot();778 });779 it('Dispatches the correct action and payload (startTimer)', () => {780 const expectedActions = [781 {782 type: actionTypes.START_TIMER783 }784 ];785 store.dispatch(Actions.startTimer());786 expect(store.getActions()).toEqual(expectedActions);787 expect(store.getActions()).toMatchSnapshot();788 });789 it('Dispatches the correct action and payload (clickWireButton)', () => {790 const expectedActions = [791 {792 type: actionTypes.CLICK_WIRE_BUTTON793 }794 ];795 store.dispatch(Actions.clickWireButton());796 expect(store.getActions()).toEqual(expectedActions);797 expect(store.getActions()).toMatchSnapshot();798 });799 it('Dispatches the correct action and payload (showAutoWireBuyer)', () => {800 const expectedActions = [801 {802 type: actionTypes.SHOW_AUTO_WIRE_BUYER803 }804 ];805 store.dispatch(Actions.showAutoWireBuyer());806 expect(store.getActions()).toEqual(expectedActions);807 expect(store.getActions()).toMatchSnapshot();808 });809 it('Dispatches the correct action and payload (toggleWireBuyerProject)', () => {810 const expectedActions = [811 {812 type: actionTypes.TOGGLE_WIRE_BUYER_PROJECT813 }814 ];815 store.dispatch(Actions.toggleWireBuyerProject());816 expect(store.getActions()).toEqual(expectedActions);817 expect(store.getActions()).toMatchSnapshot();818 });819 it('Dispatches the correct action and payload (autoWireBuyer)', () => {820 const expectedActions = [821 {822 type: actionTypes.AUTO_WIRE_BUYER823 }824 ];825 store.dispatch(Actions.autoWireBuyer());826 expect(store.getActions()).toEqual(expectedActions);827 expect(store.getActions()).toMatchSnapshot();828 });829 830 it('Dispatches the correct action and payload (toggleAutoWireBuyer)', () => {831 const expectedActions = [832 {833 type: actionTypes.TOGGLE_AUTO_WIRE_BUYER834 }835 ];836 store.dispatch(Actions.toggleAutoWireBuyer());837 expect(store.getActions()).toEqual(expectedActions);838 expect(store.getActions()).toMatchSnapshot();839 });840 it('Dispatches the correct action and payload (addMegaClippers)', () => {841 const expectedActions = [842 {843 type: actionTypes.ADD_MEGA_CLIPPERS844 }845 ];846 store.dispatch(Actions.addMegaClippers());847 expect(store.getActions()).toEqual(expectedActions);848 expect(store.getActions()).toMatchSnapshot();849 });850 it('Dispatches the correct action and payload (showMegaClippers)', () => {851 const expectedActions = [852 {853 type: actionTypes.SHOW_MEGA_CLIPPERS854 }855 ];856 store.dispatch(Actions.showMegaClippers());857 expect(store.getActions()).toEqual(expectedActions);858 expect(store.getActions()).toMatchSnapshot();859 });860 it('Dispatches the correct action and payload (showAutoClippers)', () => {861 const expectedActions = [862 {863 type: actionTypes.SHOW_AUTO_CLIPPERS864 }865 ];866 store.dispatch(Actions.showAutoClippers());867 expect(store.getActions()).toEqual(expectedActions);868 expect(store.getActions()).toMatchSnapshot();869 });870 it('Dispatches the correct action and payload (calcDelayUnsoldInventary)', () => {871 const expectedActions = [872 {873 type: actionTypes.CALC_DELAY_UNSOLD_INVENTARY874 }875 ];876 store.dispatch(Actions.calcDelayUnsoldInventary());877 expect(store.getActions()).toEqual(expectedActions);878 expect(store.getActions()).toMatchSnapshot();879 });880 it('Dispatches the correct action and payload (updateClipsPerSec)', () => {881 const expectedActions = [882 {883 type: actionTypes.UPDATE_CLIPS_PER_SEC,884 val: 7885 }886 ];887 store.dispatch(Actions.updateClipsPerSec(7));888 expect(store.getActions()).toEqual(expectedActions);889 expect(store.getActions()).toMatchSnapshot();890 });891 it('Dispatches the correct action and payload (startInvestmentsDeposit)', () => {892 const expectedActions = [893 {894 type: actionTypes.START_INVESTMENTS_DEPOSIT895 }896 ];897 store.dispatch(Actions.startInvestmentsDeposit());898 expect(store.getActions()).toEqual(expectedActions);899 expect(store.getActions()).toMatchSnapshot();900 });901 it('Dispatches the correct action and payload (getDeposit)', () => {902 const expectedActions = [903 {904 type: actionTypes.GET_DEPOSIT905 }906 ];907 store.dispatch(Actions.getDeposit());908 expect(store.getActions()).toEqual(expectedActions);909 expect(store.getActions()).toMatchSnapshot();910 });911 it('Dispatches the correct action and payload (startUpdatingScreen)', () => {912 const expectedActions = [913 {914 type: actionTypes.START_UPDATING_SCREEN915 }916 ];917 store.dispatch(Actions.startUpdatingScreen());918 expect(store.getActions()).toEqual(expectedActions);919 expect(store.getActions()).toMatchSnapshot();920 });921 it('Dispatches the correct action and payload (stopUpdatingScreen)', () => {922 const expectedActions = [923 {924 type: actionTypes.STOP_UPDATING_SCREEN925 }926 ];927 store.dispatch(Actions.stopUpdatingScreen());928 expect(store.getActions()).toEqual(expectedActions);929 expect(store.getActions()).toMatchSnapshot();930 });931 it('Dispatches the correct action and payload (addInvestmentsLine)', () => {932 const expectedActions = [933 {934 type: actionTypes.ADD_INVESTMENTS_LINE,935 obj: '',936 notEmpty: false937 }938 ];939 store.dispatch(Actions.addInvestmentsLine('', false));940 expect(store.getActions()).toEqual(expectedActions);941 expect(store.getActions()).toMatchSnapshot();942 });943 it('Dispatches the correct action and payload (startUpdatingInvestmentLines)', () => {944 const expectedActions = [945 {946 type: actionTypes.START_UPDATING_INVESTMENTS_LINE947 }948 ];949 store.dispatch(Actions.startUpdatingInvestmentLines('', false));950 expect(store.getActions()).toEqual(expectedActions);951 expect(store.getActions()).toMatchSnapshot();952 });953 it('Dispatches the correct action and payload (stopUpdatingInvestmentLines)', () => {954 const expectedActions = [955 {956 type: actionTypes.STOP_UPDATING_INVESTMENTS_LINE957 }958 ];959 store.dispatch(Actions.stopUpdatingInvestmentLines());960 expect(store.getActions()).toEqual(expectedActions);961 expect(store.getActions()).toMatchSnapshot();962 });963 it('Dispatches the correct action and payload (updateInvestmentsLines)', () => {964 const expectedActions = [965 {966 type: actionTypes.UPDATE_INVESTMENTS_LINES,967 array: [{a: 4}, {a:7}]968 }969 ];970 store.dispatch(Actions.updateInvestmentsLines([{a: 4}, {a:7}]));971 expect(store.getActions()).toEqual(expectedActions);972 expect(store.getActions()).toMatchSnapshot();973 });974 it('Dispatches the correct action and payload (startCountingRisk)', () => {975 const expectedActions = [976 {977 type: actionTypes.START_COUNTING_RISK978 }979 ];980 store.dispatch(Actions.startCountingRisk());981 expect(store.getActions()).toEqual(expectedActions);982 expect(store.getActions()).toMatchSnapshot();983 });984 it('Dispatches the correct action and payload (updateInvestmentsTotal)', () => {985 const expectedActions = [986 {987 type: actionTypes.UPDATE_INVESTMENTS_TOTAL,988 total: 543989 }990 ];991 store.dispatch(Actions.updateInvestmentsTotal(543));992 expect(store.getActions()).toEqual(expectedActions);993 expect(store.getActions()).toMatchSnapshot();994 });995 it('Dispatches the correct action and payload (updateInvestmentsCash)', () => {996 const expectedActions = [997 {998 type: actionTypes.UPDATE_INVESTMENTS_CASH,999 cash: 6441000 }1001 ];1002 store.dispatch(Actions.updateInvestmentsCash(644));1003 expect(store.getActions()).toEqual(expectedActions);1004 expect(store.getActions()).toMatchSnapshot();1005 });1006 it('Dispatches the correct action and payload (updateInvestmentsStocks)', () => {1007 const expectedActions = [1008 {1009 type: actionTypes.UPDATE_INVESTMENTS_STOCKS,1010 stocks: 7451011 }1012 ];1013 store.dispatch(Actions.updateInvestmentsStocks(745));1014 expect(store.getActions()).toEqual(expectedActions);1015 expect(store.getActions()).toMatchSnapshot();1016 });1017 it('Dispatches the correct action and payload (startApplyingProfitLoss)', () => {1018 const expectedActions = [1019 {1020 type: actionTypes.START_APPLYING_PROFIT_LOSS1021 }1022 ];1023 store.dispatch(Actions.startApplyingProfitLoss());1024 expect(store.getActions()).toEqual(expectedActions);1025 expect(store.getActions()).toMatchSnapshot();1026 });1027 it('Dispatches the correct action and payload (updateFakeInvestmentsCash)', () => {1028 const expectedActions = [1029 {1030 type: actionTypes.UPDATE_FAKE_INVESTMENTS_CASH,1031 cash: 5521032 }1033 ];1034 store.dispatch(Actions.updateFakeInvestmentsCash(552));1035 expect(store.getActions()).toEqual(expectedActions);1036 expect(store.getActions()).toMatchSnapshot();1037 });1038 it('Dispatches the correct action and payload (startInvestmentsWithdraw)', () => {1039 const expectedActions = [1040 {1041 type: actionTypes.START_INVESTMENTS_WITHDRAW1042 }1043 ];1044 store.dispatch(Actions.startInvestmentsWithdraw());1045 expect(store.getActions()).toEqual(expectedActions);1046 expect(store.getActions()).toMatchSnapshot();1047 });1048 it('Dispatches the correct action and payload (updateFundsWithdraw)', () => {1049 const expectedActions = [1050 {1051 type: actionTypes.UPDATE_FUNDS_WITHDRAW,1052 val: 35341053 }1054 ];1055 store.dispatch(Actions.updateFundsWithdraw(3534));1056 expect(store.getActions()).toEqual(expectedActions);1057 expect(store.getActions()).toMatchSnapshot();1058 });1059 it('Dispatches the correct action and payload (chooseFromDropdown)', () => {1060 const expectedActions = [1061 {1062 type: actionTypes.CHOOSE_FROM_DROPDOWN,1063 chosen: "I am chosen",1064 index: 11065 }1066 ];1067 store.dispatch(Actions.chooseFromDropdown("I am chosen", 1));1068 expect(store.getActions()).toEqual(expectedActions);1069 expect(store.getActions()).toMatchSnapshot();1070 });1071 it('Dispatches the correct action and payload (addChosenFromDropdown)', () => {1072 const expectedActions = [1073 {1074 type: actionTypes.ADD_CHOSEN_FROM_DROPDOWN,1075 chosen: "I am chosen",1076 index: 01077 }1078 ];1079 store.dispatch(Actions.addChosenFromDropdown("I am chosen", 0));1080 expect(store.getActions()).toEqual(expectedActions);1081 expect(store.getActions()).toMatchSnapshot();1082 });1083 it('Dispatches the correct action and payload (updateInvestmentsDelay)', () => {1084 const expectedActions = [1085 {1086 type: actionTypes.UPDATE_INVESTMENTS_DELAY,1087 delayScreen: 4000,1088 delayLines: 30001089 }1090 ];1091 store.dispatch(Actions.updateInvestmentsDelay(4000, 3000));1092 expect(store.getActions()).toEqual(expectedActions);1093 expect(store.getActions()).toMatchSnapshot();1094 });1095 it('Dispatches the correct action and payload (startAddingEmptyInvestmentsLine)', () => {1096 const expectedActions = [1097 {1098 type: actionTypes.START_ADDING_EMPTY_INVESTMENTS_LINE1099 }1100 ];1101 store.dispatch(Actions.startAddingEmptyInvestmentsLine());1102 expect(store.getActions()).toEqual(expectedActions);1103 expect(store.getActions()).toMatchSnapshot();1104 });1105 it('Dispatches the correct action and payload (stopAddingEmptyInvestmentsLine)', () => {1106 const expectedActions = [1107 {1108 type: actionTypes.STOP_ADDING_EMPTY_INVESTMENTS_LINE1109 }1110 ];1111 store.dispatch(Actions.stopAddingEmptyInvestmentsLine());1112 expect(store.getActions()).toEqual(expectedActions);1113 expect(store.getActions()).toMatchSnapshot();1114 });1115 it('Dispatches the correct action and payload (updateAvgRevPerSec)', () => {1116 const expectedActions = [1117 {1118 type: actionTypes.UPDATE_AVG_REV_PER_SEC,1119 val: 51120 }1121 ];1122 store.dispatch(Actions.updateAvgRevPerSec(5));1123 expect(store.getActions()).toEqual(expectedActions);1124 expect(store.getActions()).toMatchSnapshot();1125 });1126 it('Dispatches the correct action and payload (updateAvgClipsSoldPerSec)', () => {1127 const expectedActions = [1128 {1129 type: actionTypes.UPDATE_AVG_CLIPS_SOLD_PER_SEC,1130 val: 71131 }1132 ];1133 store.dispatch(Actions.updateAvgClipsSoldPerSec(7));1134 expect(store.getActions()).toEqual(expectedActions);1135 expect(store.getActions()).toMatchSnapshot();1136 });1137 it('Dispatches the correct action and payload (megaClippersButtonPressed)', () => {1138 const expectedActions = [1139 {1140 type: actionTypes.MEGA_CLIPPERS_BUTTON_PRESSED1141 }1142 ];1143 store.dispatch(Actions.megaClippersButtonPressed());1144 expect(store.getActions()).toEqual(expectedActions);1145 expect(store.getActions()).toMatchSnapshot();1146 });1147 it('Dispatches the correct action and payload (startMegaClippers)', () => {1148 const expectedActions = [1149 {1150 type: actionTypes.START_MEGACLIPPERS1151 }1152 ];1153 store.dispatch(Actions.startMegaClippers());1154 expect(store.getActions()).toEqual(expectedActions);1155 expect(store.getActions()).toMatchSnapshot();1156 });1157 it('Dispatches the correct action and payload (improveMegaClippers)', () => {1158 const expectedActions = [1159 {1160 type: actionTypes.IMPROVE_MEGA_CLIPPERS,1161 val: 361162 }1163 ];1164 store.dispatch(Actions.improveMegaClippers(36));1165 expect(store.getActions()).toEqual(expectedActions);1166 expect(store.getActions()).toMatchSnapshot();1167 });1168 it('Dispatches the correct action and payload (switchOffOrOnAutoAndMegaClippers)', () => {1169 const expectedActions = [1170 {1171 type: actionTypes.SWITCH_OFF_OR_ON_AUTO_AND_MEGA_CLIPPERS,1172 val: true1173 }1174 ];1175 store.dispatch(Actions.switchOffOrOnAutoAndMegaClippers(true));1176 expect(store.getActions()).toEqual(expectedActions);1177 expect(store.getActions()).toMatchSnapshot();1178 });1179 it('Dispatches the correct action and payload (startNewTournament)', () => {1180 const expectedActions = [1181 {1182 type: actionTypes.START_NEW_TOURNAMENT1183 }1184 ];1185 store.dispatch(Actions.startNewTournament());1186 expect(store.getActions()).toEqual(expectedActions);1187 expect(store.getActions()).toMatchSnapshot();1188 });1189 it('Dispatches the correct action and payload (tournamentState)', () => {1190 const expectedActions = [1191 {1192 type: actionTypes.TOURNAMENT_STATE,1193 val: true1194 }1195 ];1196 store.dispatch(Actions.tournamentState(true));1197 expect(store.getActions()).toEqual(expectedActions);1198 expect(store.getActions()).toMatchSnapshot();1199 });1200 it('Dispatches the correct action and payload (updateNewTournamentCost)', () => {1201 const expectedActions = [1202 {1203 type: actionTypes.UPDATE_NEW_TOURNAMENT_COST1204 }1205 ];1206 store.dispatch(Actions.updateNewTournamentCost());1207 expect(store.getActions()).toEqual(expectedActions);1208 expect(store.getActions()).toMatchSnapshot();1209 });1210 1211 it('Dispatches the correct action and payload (toggleNewTournamentButton)', () => {1212 const expectedActions = [1213 {1214 type: actionTypes.TOGGLE_NEW_TOURNAMENT_BUTTON1215 }1216 ];1217 store.dispatch(Actions.toggleNewTournamentButton());1218 expect(store.getActions()).toEqual(expectedActions);1219 expect(store.getActions()).toMatchSnapshot();1220 });1221 it('Dispatches the correct action and payload (startRunningStrategicModeling)', () => {1222 const expectedActions = [1223 {1224 type: actionTypes.START_RUNNING_STRATEGIC_MODELING1225 }1226 ];1227 store.dispatch(Actions.startRunningStrategicModeling());1228 expect(store.getActions()).toEqual(expectedActions);1229 expect(store.getActions()).toMatchSnapshot();1230 });1231 it('Dispatches the correct action and payload (updateStrategicModelingData)', () => {1232 const expectedActions = [1233 {1234 type: actionTypes.UPDATE_STRATEGIC_MODELING_DATA,1235 obj: {a: 5, b: 5}1236 }1237 ];1238 store.dispatch(Actions.updateStrategicModelingData({a: 5, b: 5}));1239 expect(store.getActions()).toEqual(expectedActions);1240 expect(store.getActions()).toMatchSnapshot();1241 });1242 it('Dispatches the correct action and payload (updateStrategicModelingCurrentList)', () => {1243 const expectedActions = [1244 {1245 type: actionTypes.UPDATE_STRATEGIC_MODELING_CURRENT_LIST,1246 obj: {a: 5, b: 8},1247 round: 91248 }1249 ];1250 store.dispatch(Actions.updateStrategicModelingCurrentList({a: 5, b: 8}, 9));1251 expect(store.getActions()).toEqual(expectedActions);1252 expect(store.getActions()).toMatchSnapshot();1253 });1254 it('Dispatches the correct action and payload (strategyChosen)', () => {1255 const expectedActions = [1256 {1257 type: actionTypes.STRATEGY_CHOSEN,1258 strategy: "RANDOM", 1259 val: true1260 }1261 ];1262 store.dispatch(Actions.strategyChosen("RANDOM", true));1263 expect(store.getActions()).toEqual(expectedActions);1264 expect(store.getActions()).toMatchSnapshot();1265 });1266 it('Dispatches the correct action and payload (clearChosenFromStrategicModelingDropdownList)', () => {1267 const expectedActions = [1268 {1269 type: actionTypes.CLEAR_CHOSEN_FROM_STRATEGIC_MODELING_DROPDOWN_LIST1270 }1271 ];1272 store.dispatch(Actions.clearChosenFromStrategicModelingDropdownList());1273 expect(store.getActions()).toEqual(expectedActions);1274 expect(store.getActions()).toMatchSnapshot();1275 });1276 it('Dispatches the correct action and payload (updateStrategicModelingRound)', () => {1277 const expectedActions = [1278 {1279 type: actionTypes.UPDATE_STRATEGIC_MODELING_ROUND,1280 round: 41281 }1282 ];1283 store.dispatch(Actions.updateStrategicModelingRound(4));1284 expect(store.getActions()).toEqual(expectedActions);1285 expect(store.getActions()).toMatchSnapshot();1286 });1287 it('Dispatches the correct action and payload (stopTournament)', () => {1288 const expectedActions = [1289 {1290 type: actionTypes.STOP_TOURNAMENT1291 }1292 ];1293 store.dispatch(Actions.stopTournament());1294 expect(store.getActions()).toEqual(expectedActions);1295 expect(store.getActions()).toMatchSnapshot();1296 });1297 it('Dispatches the correct action and payload (tournamentDuration)', () => {1298 const expectedActions = [1299 {1300 type: actionTypes.TOURNAMENT_DURATION1301 }1302 ];1303 store.dispatch(Actions.tournamentDuration());1304 expect(store.getActions()).toEqual(expectedActions);1305 expect(store.getActions()).toMatchSnapshot();1306 });1307 it('Dispatches the correct action and payload (showRoundAndPlayers)', () => {1308 const expectedActions = [1309 {1310 type: actionTypes.SHOW_ROUND_AND_PLAYERS,1311 val: true1312 }1313 ];1314 store.dispatch(Actions.showRoundAndPlayers(true));1315 expect(store.getActions()).toEqual(expectedActions);1316 expect(store.getActions()).toMatchSnapshot();1317 });1318 1319 it('Dispatches the correct action and payload (startUpdatingRoundsOnScreen)', () => {1320 const expectedActions = [1321 {1322 type: actionTypes.START_UPDATING_ROUNDS_ON_SCREEN1323 }1324 ];1325 store.dispatch(Actions.startUpdatingRoundsOnScreen());1326 expect(store.getActions()).toEqual(expectedActions);1327 expect(store.getActions()).toMatchSnapshot();1328 });1329 it('Dispatches the correct action and payload (updateRoundsOnScreen)', () => {1330 const expectedActions = [1331 {1332 type: actionTypes.UPDATE_ROUNDS_ON_SCREEN1333 }1334 ];1335 store.dispatch(Actions.updateRoundsOnScreen());1336 expect(store.getActions()).toEqual(expectedActions);1337 expect(store.getActions()).toMatchSnapshot();1338 });1339 it('Dispatches the correct action and payload (startUpdatingPlayerLeftOnScreen)', () => {1340 const expectedActions = [1341 {1342 type: actionTypes.START_UPDATING_PLAYER_LEFT_ON_SCREEN1343 }1344 ];1345 store.dispatch(Actions.startUpdatingPlayerLeftOnScreen());1346 expect(store.getActions()).toEqual(expectedActions);1347 expect(store.getActions()).toMatchSnapshot();1348 });1349 1350 it('Dispatches the correct action and payload (updatePlayerLeftOnScreen)', () => {1351 const expectedActions = [1352 {1353 type: actionTypes.UPDATE_PLAYER_LEFT_ON_SCREEN1354 }1355 ];1356 store.dispatch(Actions.updatePlayerLeftOnScreen());1357 expect(store.getActions()).toEqual(expectedActions);1358 expect(store.getActions()).toMatchSnapshot();1359 });1360 it('Dispatches the correct action and payload (startUpdatingPlayerTopOnScreen)', () => {1361 const expectedActions = [1362 {1363 type: actionTypes.START_UPDATING_PLAYER_TOP_ON_SCREEN1364 }1365 ];1366 store.dispatch(Actions.startUpdatingPlayerTopOnScreen());1367 expect(store.getActions()).toEqual(expectedActions);1368 expect(store.getActions()).toMatchSnapshot();1369 });1370 it('Dispatches the correct action and payload (updatePlayerTopOnScreen)', () => {1371 const expectedActions = [1372 {1373 type: actionTypes.UPDATE_PLAYER_TOP_ON_SCREEN1374 }1375 ];1376 store.dispatch(Actions.updatePlayerTopOnScreen());1377 expect(store.getActions()).toEqual(expectedActions);1378 expect(store.getActions()).toMatchSnapshot();1379 });1380 it('Dispatches the correct action and payload (setPlayersArrays)', () => {1381 const expectedActions = [1382 {1383 type: actionTypes.SET_PLAYERS_ARRAY1384 }1385 ];1386 store.dispatch(Actions.setPlayersArrays());1387 expect(store.getActions()).toEqual(expectedActions);1388 expect(store.getActions()).toMatchSnapshot();1389 });1390 it('Dispatches the correct action and payload (gameStarted)', () => {1391 const expectedActions = [1392 {1393 type: actionTypes.GAME_STARTED1394 }1395 ];1396 store.dispatch(Actions.gameStarted());1397 expect(store.getActions()).toEqual(expectedActions);1398 expect(store.getActions()).toMatchSnapshot();1399 });1400 it('Dispatches the correct action and payload (allRoundsResult)', () => {1401 const expectedActions = [1402 {1403 type: actionTypes.ALL_ROUNDS_RESULT,1404 obj: {a: 6, b: 7}1405 }1406 ];1407 store.dispatch(Actions.allRoundsResult({a: 6, b: 7}));1408 expect(store.getActions()).toEqual(expectedActions);1409 expect(store.getActions()).toMatchSnapshot();1410 });1411 it('Dispatches the correct action and payload (strategicModelingResult)', () => {1412 const expectedActions = [1413 {1414 type: actionTypes.STRATEGIC_MODELING_RESULT1415 }1416 ];1417 store.dispatch(Actions.strategicModelingResult());1418 expect(store.getActions()).toEqual(expectedActions);1419 expect(store.getActions()).toMatchSnapshot();1420 });1421 it('Dispatches the correct action and payload (startCountingResult)', () => {1422 const expectedActions = [1423 {1424 type: actionTypes.START_COUNTING_RESULT1425 }1426 ];1427 store.dispatch(Actions.startCountingResult());1428 expect(store.getActions()).toEqual(expectedActions);1429 expect(store.getActions()).toMatchSnapshot();1430 });1431 it('Dispatches the correct action and payload (updatedAllRoundsRes)', () => {1432 const expectedActions = [1433 {1434 type: actionTypes.UPDATED_ALL_ROUNDS_RES,1435 array: [{a: 9, b: 8}]1436 }1437 ];1438 store.dispatch(Actions.updatedAllRoundsRes([{a: 9, b: 8}]));1439 expect(store.getActions()).toEqual(expectedActions);1440 expect(store.getActions()).toMatchSnapshot();1441 });1442 it('Dispatches the correct action and payload (countFinalResultOfEachStrategy)', () => {1443 const expectedActions = [1444 {1445 type: actionTypes.COUNT_FINAL_RESULT_OF_EACH_STRATEGY1446 }1447 ];1448 store.dispatch(Actions.countFinalResultOfEachStrategy());1449 expect(store.getActions()).toEqual(expectedActions);1450 expect(store.getActions()).toMatchSnapshot();1451 });1452 it('Dispatches the correct action and payload (updateListOfFinalResult)', () => {1453 const expectedActions = [1454 {1455 type: actionTypes.UPDATE_LIST_OF_FINAL_RESULT,1456 obj: {a: 7, b: 9}1457 }1458 ];1459 store.dispatch(Actions.updateListOfFinalResult({a: 7, b: 9}));1460 expect(store.getActions()).toEqual(expectedActions);1461 expect(store.getActions()).toMatchSnapshot();1462 });1463 it('Dispatches the correct action and payload (fillWithValuesStrategicModelingCurrentList)', () => {1464 const expectedActions = [1465 {1466 type: actionTypes.FILL_WITH_VALUES_STRATEGIC_MODELING_CURRENT_LIST1467 }1468 ];1469 store.dispatch(Actions.fillWithValuesStrategicModelingCurrentList());1470 expect(store.getActions()).toEqual(expectedActions);1471 expect(store.getActions()).toMatchSnapshot();1472 });1473 it('Dispatches the correct action and payload (toggleStrategicModelingLeftPart)', () => {1474 const expectedActions = [1475 {1476 type: actionTypes.TOGGLE_STRATEGIC_MODELING_LEFT_PART,1477 val: false1478 }1479 ];1480 store.dispatch(Actions.toggleStrategicModelingLeftPart(false));1481 expect(store.getActions()).toEqual(expectedActions);1482 expect(store.getActions()).toMatchSnapshot();1483 });1484 it('Dispatches the correct action and payload (toggleStrategicModelingHover)', () => {1485 const expectedActions = [1486 {1487 type: actionTypes.TOGGLE_STRATEGIC_MODELING_HOVER,1488 val: true1489 }1490 ];1491 store.dispatch(Actions.toggleStrategicModelingHover(true));1492 expect(store.getActions()).toEqual(expectedActions);1493 expect(store.getActions()).toMatchSnapshot();1494 });1495 it('Dispatches the correct action and payload (toggleCells)', () => {1496 const expectedActions = [1497 {1498 type: actionTypes.TOGGLE_CELLS,1499 obj: {a: 3, b: 5}1500 }1501 ];1502 store.dispatch(Actions.toggleCells({a: 3, b: 5}));1503 expect(store.getActions()).toEqual(expectedActions);1504 expect(store.getActions()).toMatchSnapshot();1505 });1506 it('Dispatches the correct action and payload (updateYomi)', () => {1507 const expectedActions = [1508 {1509 type: actionTypes.UPDATE_YOMI1510 }1511 ];1512 store.dispatch(Actions.updateYomi());1513 expect(store.getActions()).toEqual(expectedActions);1514 expect(store.getActions()).toMatchSnapshot();1515 });1516 it('Dispatches the correct action and payload (removePriceOfProjectOpsCreatAndYomi)', () => {1517 const expectedActions = [1518 {1519 type: actionTypes.REMOVE_PRICE_OF_PROJECT_OPS_CREAT_AND_YOMI,1520 ops: 5,1521 creativity: 6,1522 yomi: 71523 }1524 ];1525 store.dispatch(Actions.removePriceOfProjectOpsCreatAndYomi(5, 6, 7));1526 expect(store.getActions()).toEqual(expectedActions);1527 expect(store.getActions()).toMatchSnapshot();1528 });1529 it('Dispatches the correct action and payload (removePriceOfProjectOpsAndYomi)', () => {1530 const expectedActions = [1531 {1532 type: actionTypes.REMOVE_PRICE_OF_PROJECT_OPS_AND_YOMI,1533 ops: 5,1534 yomi: 71535 }1536 ];1537 store.dispatch(Actions.removePriceOfProjectOpsAndYomi(5, 7));1538 expect(store.getActions()).toEqual(expectedActions);1539 expect(store.getActions()).toMatchSnapshot();1540 });1541 it('Dispatches the correct action and payload (removePriceOfProjectYomiAndMoney)', () => {1542 const expectedActions = [1543 {1544 type: actionTypes.REMOVE_PRICE_OF_PROJECT_YOMI_AND_MONEY,1545 yomi: 5,1546 money: 7,1547 }1548 ];1549 store.dispatch(Actions.removePriceOfProjectYomiAndMoney(5, 7));1550 expect(store.getActions()).toEqual(expectedActions);1551 expect(store.getActions()).toMatchSnapshot();1552 });1553 it('Dispatches the correct action and payload (removePriceOfProjectMoney)', () => {1554 const expectedActions = [1555 {1556 type: actionTypes.REMOVE_PRICE_OF_PROJECT_MONEY,1557 money: 61558 }1559 ];1560 store.dispatch(Actions.removePriceOfProjectMoney(6));1561 expect(store.getActions()).toEqual(expectedActions);1562 expect(store.getActions()).toMatchSnapshot();1563 });1564 it('Dispatches the correct action and payload (reallocationOfTrust)', () => {1565 const expectedActions = [1566 {1567 type: actionTypes.REALLOCATION_OF_TRUST,1568 }1569 ];1570 store.dispatch(Actions.reallocationOfTrust());1571 expect(store.getActions()).toEqual(expectedActions);1572 expect(store.getActions()).toMatchSnapshot();1573 });1574 it('Dispatches the correct action and payload (upgradeInvestmentEngine)', () => {1575 const expectedActions = [1576 {1577 type: actionTypes.UPGRADE_INVESTMENT_ENGINE,1578 }1579 ];1580 store.dispatch(Actions.upgradeInvestmentEngine());1581 expect(store.getActions()).toEqual(expectedActions);1582 expect(store.getActions()).toMatchSnapshot();1583 });1584 it('Dispatches the correct action and payload (stateFromLocalStorage)', () => {1585 const expectedActions = [1586 {1587 type: actionTypes.STATE_FROM_LOCAL_STORAGE,1588 state: {a: 5, b: 5}1589 }1590 ];1591 store.dispatch(Actions.stateFromLocalStorage({a: 5, b: 5}));1592 expect(store.getActions()).toEqual(expectedActions);1593 expect(store.getActions()).toMatchSnapshot();1594 });1595 it('Dispatches the correct action and payload (toggleThrownProject)', () => {1596 const expectedActions = [1597 {1598 type: actionTypes.TOGGLE_THROWN_PROJECT,1599 project: "paperclip",1600 val: true1601 }1602 ];1603 store.dispatch(Actions.toggleThrownProject("paperclip", true));1604 expect(store.getActions()).toEqual(expectedActions);1605 expect(store.getActions()).toMatchSnapshot();1606 });1607 it('Dispatches the correct action and payload (removeUnnecessaryCards)', () => {1608 const expectedActions = [1609 {1610 type: actionTypes.REMOVE_UNNECESSARY_CARDS1611 }1612 ];1613 store.dispatch(Actions.removeUnnecessaryCards());1614 expect(store.getActions()).toEqual(expectedActions);1615 expect(store.getActions()).toMatchSnapshot();1616 });1617 it('Dispatches the correct action and payload (showManufacturingSection)', () => {1618 const expectedActions = [1619 {1620 type: actionTypes.SHOW_MANUFACTURING_SECTION,1621 val: true1622 }1623 ];1624 store.dispatch(Actions.showManufacturingSection(true));1625 expect(store.getActions()).toEqual(expectedActions);1626 expect(store.getActions()).toMatchSnapshot();1627 });1628 it('Dispatches the correct action and payload (updateWire)', () => {1629 const expectedActions = [1630 {1631 type: actionTypes.UPDATE_WIRE,1632 val: 401633 }1634 ];1635 store.dispatch(Actions.updateWire(40));1636 expect(store.getActions()).toEqual(expectedActions);1637 expect(store.getActions()).toMatchSnapshot();1638 });1639 it('Dispatches the correct action and payload (showBusinessSection)', () => {1640 const expectedActions = [1641 {1642 type: actionTypes.SHOW_BUSINESS_SECTION,1643 val: true1644 }1645 ];1646 store.dispatch(Actions.showBusinessSection(true));1647 expect(store.getActions()).toEqual(expectedActions);1648 expect(store.getActions()).toMatchSnapshot();1649 });1650 it('Dispatches the correct action and payload (showProcessorsNumber)', () => {1651 const expectedActions = [1652 {1653 type: actionTypes.SHOW_PROCESSORS_NUMBER,1654 val: true1655 }1656 ];1657 store.dispatch(Actions.showProcessorsNumber(true));1658 expect(store.getActions()).toEqual(expectedActions);1659 expect(store.getActions()).toMatchSnapshot();1660 });1661 it('Dispatches the correct action and payload (showProcessorsMemory)', () => {1662 const expectedActions = [1663 {1664 type: actionTypes.SHOW_PROCESSORS_MEMORY,1665 val: true1666 }1667 ];1668 store.dispatch(Actions.showProcessorsMemory(true));1669 expect(store.getActions()).toEqual(expectedActions);1670 expect(store.getActions()).toMatchSnapshot();1671 });1672 it('Dispatches the correct action and payload (showEnding)', () => {1673 const expectedActions = [1674 {1675 type: actionTypes.SHOW_ENDING,1676 val: true1677 }1678 ];1679 store.dispatch(Actions.showEnding(true));1680 expect(store.getActions()).toEqual(expectedActions);1681 expect(store.getActions()).toMatchSnapshot();1682 });1683 it('Dispatches the correct action and payload (lastComents)', () => {1684 const expectedActions = [1685 {1686 type: actionTypes.LAST_COMMENTS1687 }1688 ];1689 store.dispatch(Actions.lastComents());1690 expect(store.getActions()).toEqual(expectedActions);1691 expect(store.getActions()).toMatchSnapshot();1692 });1693 it('Dispatches the correct action and payload (stopSendingLastComments)', () => {1694 const expectedActions = [1695 {1696 type: actionTypes.STOP_SENDING_LAST_COMMENTS1697 }1698 ];1699 store.dispatch(Actions.stopSendingLastComments());1700 expect(store.getActions()).toEqual(expectedActions);1701 expect(store.getActions()).toMatchSnapshot();1702 });1703 it('Dispatches the correct action and payload (stopComments)', () => {1704 const expectedActions = [1705 {1706 type: actionTypes.STOP_COMMENTS1707 }1708 ];1709 store.dispatch(Actions.stopComments());1710 expect(store.getActions()).toEqual(expectedActions);1711 expect(store.getActions()).toMatchSnapshot();1712 });1713 it('Dispatches the correct action and payload (countdownOnClick)', () => {1714 const expectedActions = [1715 {1716 type: actionTypes.COUNTDOWN_ON_CLICK1717 }1718 ];1719 store.dispatch(Actions.countdownOnClick());1720 expect(store.getActions()).toEqual(expectedActions);1721 expect(store.getActions()).toMatchSnapshot();1722 });1723 it('Dispatches the correct action and payload (toggleGameOver)', () => {1724 const expectedActions = [1725 {1726 type: actionTypes.TOGGLE_GAME_OVER,1727 val: true1728 }1729 ];1730 store.dispatch(Actions.toggleGameOver(true));1731 expect(store.getActions()).toEqual(expectedActions);1732 expect(store.getActions()).toMatchSnapshot();1733 });...
ShortcutsDialog.py
Source:ShortcutsDialog.py
...116 pm.initOnDemandPlugins()117 118 # populate the various lists119 self.projectItem = self.__generateCategoryItem(self.tr("Project"))120 for act in e5App().getObject("Project").getActions():121 self.__generateShortcutItem(self.projectItem, act)122 123 self.uiItem = self.__generateCategoryItem(self.tr("General"))124 for act in e5App().getObject("UserInterface").getActions('ui'):125 self.__generateShortcutItem(self.uiItem, act)126 127 self.wizardsItem = self.__generateCategoryItem(self.tr("Wizards"))128 for act in e5App().getObject("UserInterface").getActions('wizards'):129 self.__generateShortcutItem(self.wizardsItem, act)130 131 self.debugItem = self.__generateCategoryItem(self.tr("Debug"))132 for act in e5App().getObject("DebugUI").getActions():133 self.__generateShortcutItem(self.debugItem, act)134 135 self.editItem = self.__generateCategoryItem(self.tr("Edit"))136 for act in e5App().getObject("ViewManager").getActions('edit'):137 self.__generateShortcutItem(self.editItem, act)138 139 self.fileItem = self.__generateCategoryItem(self.tr("File"))140 for act in e5App().getObject("ViewManager").getActions('file'):141 self.__generateShortcutItem(self.fileItem, act)142 143 self.searchItem = self.__generateCategoryItem(self.tr("Search"))144 for act in e5App().getObject("ViewManager").getActions('search'):145 self.__generateShortcutItem(self.searchItem, act)146 147 self.viewItem = self.__generateCategoryItem(self.tr("View"))148 for act in e5App().getObject("ViewManager").getActions('view'):149 self.__generateShortcutItem(self.viewItem, act)150 151 self.macroItem = self.__generateCategoryItem(self.tr("Macro"))152 for act in e5App().getObject("ViewManager").getActions('macro'):153 self.__generateShortcutItem(self.macroItem, act)154 155 self.bookmarkItem = self.__generateCategoryItem(156 self.tr("Bookmarks"))157 for act in e5App().getObject("ViewManager").getActions('bookmark'):158 self.__generateShortcutItem(self.bookmarkItem, act)159 160 self.spellingItem = self.__generateCategoryItem(161 self.tr("Spelling"))162 for act in e5App().getObject("ViewManager").getActions('spelling'):163 self.__generateShortcutItem(self.spellingItem, act)164 165 actions = e5App().getObject("ViewManager").getActions('window')166 if actions:167 self.windowItem = self.__generateCategoryItem(168 self.tr("Window"))169 for act in actions:170 self.__generateShortcutItem(self.windowItem, act)171 172 self.pluginCategoryItems = []173 for category, ref in e5App().getPluginObjects():174 if hasattr(ref, "getActions"):175 categoryItem = self.__generateCategoryItem(category)176 objectType = e5App().getPluginObjectType(category)177 for act in ref.getActions():178 self.__generateShortcutItem(categoryItem, act,179 objectType=objectType)180 self.pluginCategoryItems.append(categoryItem)181 182 try:183 dummyHelpViewer = e5App().getObject("DummyHelpViewer")184 self.helpViewerItem = self.__generateCategoryItem(185 self.tr("eric6 Web Browser"))186 for act in dummyHelpViewer.getActions():187 self.__generateShortcutItem(self.helpViewerItem, act, True)188 except KeyError:189 # no QtWebKit available190 pass191 192 self.__resort()193 self.__resizeColumns()194 195 self.__editTopItem = None196 197 def on_shortcutsList_itemDoubleClicked(self, itm, column):198 """199 Private slot to handle a double click in the shortcuts list.200 201 @param itm the list item that was double clicked (QTreeWidgetItem)202 @param column the list item was double clicked in (integer)203 """204 if itm.childCount():205 return206 207 self.__editTopItem = itm.parent()208 209 self.shortcutDialog.setKeys(210 QKeySequence(itm.text(1)),211 QKeySequence(itm.text(2)),212 itm.data(0, self.noCheckRole),213 itm.data(0, self.objectTypeRole))214 self.shortcutDialog.show()215 216 def on_shortcutsList_itemClicked(self, itm, column):217 """218 Private slot to handle a click in the shortcuts list.219 220 @param itm the list item that was clicked (QTreeWidgetItem)221 @param column the list item was clicked in (integer)222 """223 if itm.childCount() or column not in [1, 2]:224 return225 226 self.shortcutsList.openPersistentEditor(itm, column)227 228 def on_shortcutsList_itemChanged(self, itm, column):229 """230 Private slot to handle the edit of a shortcut key.231 232 @param itm reference to the item changed (QTreeWidgetItem)233 @param column column changed (integer)234 """235 if column != 0:236 keystr = itm.text(column).title()237 if not itm.data(0, self.noCheckRole) and \238 not self.__checkShortcut(QKeySequence(keystr),239 itm.data(0, self.objectTypeRole),240 itm.parent()):241 itm.setText(column, "")242 else:243 itm.setText(column, keystr)244 self.shortcutsList.closePersistentEditor(itm, column)245 def __shortcutChanged(self, keysequence, altKeysequence, noCheck,246 objectType):247 """248 Private slot to handle the shortcutChanged signal of the shortcut249 dialog.250 251 @param keysequence the keysequence of the changed action (QKeySequence)252 @param altKeysequence the alternative keysequence of the changed253 action (QKeySequence)254 @param noCheck flag indicating that no uniqueness check should255 be performed (boolean)256 @param objectType type of the object (string).257 """258 if not noCheck and \259 (not self.__checkShortcut(260 keysequence, objectType, self.__editTopItem) or261 not self.__checkShortcut(262 altKeysequence, objectType, self.__editTopItem)):263 return264 265 self.shortcutsList.currentItem().setText(1, keysequence.toString())266 self.shortcutsList.currentItem().setText(2, altKeysequence.toString())267 268 self.__resort()269 self.__resizeColumns()270 271 def __checkShortcut(self, keysequence, objectType, origTopItem):272 """273 Private method to check a keysequence for uniqueness.274 275 @param keysequence the keysequence to check (QKeySequence)276 @param objectType type of the object (string). Entries with the same277 object type are not checked for uniqueness.278 @param origTopItem refrence to the parent of the item to be checked279 (QTreeWidgetItem)280 @return flag indicating uniqueness (boolean)281 """282 if keysequence.isEmpty():283 return True284 285 keystr = keysequence.toString()286 keyname = self.shortcutsList.currentItem().text(0)287 for topIndex in range(self.shortcutsList.topLevelItemCount()):288 topItem = self.shortcutsList.topLevelItem(topIndex)289 for index in range(topItem.childCount()):290 itm = topItem.child(index)291 292 # 1. shall a check be performed?293 if itm.data(0, self.noCheckRole):294 continue295 296 # 2. check object type297 itmObjectType = itm.data(0, self.objectTypeRole)298 if itmObjectType and \299 itmObjectType == objectType and \300 topItem != origTopItem:301 continue302 303 # 3. check key name304 if itm.text(0) != keyname:305 for col in [1, 2]: # check against primary,306 # then alternative binding307 itmseq = itm.text(col)308 # step 1: check if shortcut is already allocated309 if keystr == itmseq:310 res = E5MessageBox.yesNo(311 self,312 self.tr("Edit shortcuts"),313 self.tr(314 """<p><b>{0}</b> has already been"""315 """ allocated to the <b>{1}</b> action. """316 """Remove this binding?</p>""")317 .format(keystr, itm.text(0)),318 icon=E5MessageBox.Warning)319 if res:320 itm.setText(col, "")321 return True322 else:323 return False324 325 if not itmseq:326 continue327 328 # step 2: check if shortcut hides an already allocated329 if itmseq.startswith("{0}+".format(keystr)):330 res = E5MessageBox.yesNo(331 self,332 self.tr("Edit shortcuts"),333 self.tr(334 """<p><b>{0}</b> hides the <b>{1}</b>"""335 """ action. Remove this binding?</p>""")336 .format(keystr, itm.text(0)),337 icon=E5MessageBox.Warning)338 if res:339 itm.setText(col, "")340 return True341 else:342 return False343 344 # step 3: check if shortcut is hidden by an345 # already allocated346 if keystr.startswith("{0}+".format(itmseq)):347 res = E5MessageBox.yesNo(348 self,349 self.tr("Edit shortcuts"),350 self.tr(351 """<p><b>{0}</b> is hidden by the """352 """<b>{1}</b> action. """353 """Remove this binding?</p>""")354 .format(keystr, itm.text(0)),355 icon=E5MessageBox.Warning)356 if res:357 itm.setText(col, "")358 return True359 else:360 return False361 362 return True363 364 def __saveCategoryActions(self, category, actions):365 """366 Private method to save the actions for a category.367 368 @param category reference to the category item (QTreeWidgetItem)369 @param actions list of actions for the category (list of E5Action)370 """371 for index in range(category.childCount()):372 itm = category.child(index)373 txt = itm.data(0, self.objectNameRole)374 for act in actions:375 if txt == act.objectName():376 act.setShortcut(QKeySequence(itm.text(1)))377 act.setAlternateShortcut(378 QKeySequence(itm.text(2)), removeEmpty=True)379 break380 381 def on_buttonBox_accepted(self):382 """383 Private slot to handle the OK button press.384 """385 self.__saveCategoryActions(386 self.projectItem,387 e5App().getObject("Project").getActions())388 self.__saveCategoryActions(389 self.uiItem,390 e5App().getObject("UserInterface").getActions('ui'))391 self.__saveCategoryActions(392 self.wizardsItem,393 e5App().getObject("UserInterface").getActions('wizards'))394 self.__saveCategoryActions(395 self.debugItem,396 e5App().getObject("DebugUI").getActions())397 self.__saveCategoryActions(398 self.editItem,399 e5App().getObject("ViewManager").getActions('edit'))400 self.__saveCategoryActions(401 self.fileItem,402 e5App().getObject("ViewManager").getActions('file'))403 self.__saveCategoryActions(404 self.searchItem,405 e5App().getObject("ViewManager").getActions('search'))406 self.__saveCategoryActions(407 self.viewItem,408 e5App().getObject("ViewManager").getActions('view'))409 self.__saveCategoryActions(410 self.macroItem,411 e5App().getObject("ViewManager").getActions('macro'))412 self.__saveCategoryActions(413 self.bookmarkItem,414 e5App().getObject("ViewManager").getActions('bookmark'))415 self.__saveCategoryActions(416 self.spellingItem,417 e5App().getObject("ViewManager").getActions('spelling'))418 419 actions = e5App().getObject("ViewManager").getActions('window')420 if actions:421 self.__saveCategoryActions(self.windowItem, actions)422 423 for categoryItem in self.pluginCategoryItems:424 category = categoryItem.text(0)425 ref = e5App().getPluginObject(category)426 if ref is not None and hasattr(ref, "getActions"):427 self.__saveCategoryActions(categoryItem, ref.getActions())428 429 try:430 dummyHelpViewer = e5App().getObject("DummyHelpViewer")431 self.__saveCategoryActions(432 self.helpViewerItem, dummyHelpViewer.getActions())433 except KeyError:434 # no QtWebKit available435 pass436 437 Shortcuts.saveShortcuts()438 Preferences.syncPreferences()439 440 self.updateShortcuts.emit()441 self.hide()442 443 @pyqtSlot(str)444 def on_searchEdit_textChanged(self, txt):445 """446 Private slot called, when the text in the search edit changes....
Shortcuts.py
Source:Shortcuts.py
...36 @keyparam pluginName name of the plugin for which to load shortcuts37 (string)38 """39 if helpViewer is None and pluginName is None:40 for act in e5App().getObject("Project").getActions():41 __readShortcut(act, "Project", prefClass)42 43 for act in e5App().getObject("UserInterface").getActions('ui'):44 __readShortcut(act, "General", prefClass)45 46 for act in e5App().getObject("UserInterface").getActions('wizards'):47 __readShortcut(act, "Wizards", prefClass)48 49 for act in e5App().getObject("DebugUI").getActions():50 __readShortcut(act, "Debug", prefClass)51 52 for act in e5App().getObject("ViewManager").getActions('edit'):53 __readShortcut(act, "Edit", prefClass)54 55 for act in e5App().getObject("ViewManager").getActions('file'):56 __readShortcut(act, "File", prefClass)57 58 for act in e5App().getObject("ViewManager").getActions('search'):59 __readShortcut(act, "Search", prefClass)60 61 for act in e5App().getObject("ViewManager").getActions('view'):62 __readShortcut(act, "View", prefClass)63 64 for act in e5App().getObject("ViewManager").getActions('macro'):65 __readShortcut(act, "Macro", prefClass)66 67 for act in e5App().getObject("ViewManager").getActions('bookmark'):68 __readShortcut(act, "Bookmarks", prefClass)69 70 for act in e5App().getObject("ViewManager").getActions('spelling'):71 __readShortcut(act, "Spelling", prefClass)72 73 actions = e5App().getObject("ViewManager").getActions('window')74 if actions:75 for act in actions:76 __readShortcut(act, "Window", prefClass)77 78 for category, ref in e5App().getPluginObjects():79 if hasattr(ref, "getActions"):80 actions = ref.getActions()81 for act in actions:82 __readShortcut(act, category, prefClass)83 84 if helpViewer is not None:85 for act in helpViewer.getActions():86 __readShortcut(act, "HelpViewer", prefClass)87 88 if pluginName is not None:89 try:90 ref = e5App().getPluginObject(pluginName)91 if hasattr(ref, "getActions"):92 actions = ref.getActions()93 for act in actions:94 __readShortcut(act, pluginName, prefClass)95 except KeyError:96 # silently ignore non available plugins97 pass98 99def __saveShortcut(act, category, prefClass):100 """101 Private function to write a single keyboard shortcut to the settings.102 103 @param act reference to the action object (E5Action)104 @param category category the action belongs to (string)105 @param prefClass preferences class used as the storage area106 """107 if act.objectName():108 prefClass.settings.setValue(109 "Shortcuts/{0}/{1}/Accel".format(category, act.objectName()),110 act.shortcut().toString())111 prefClass.settings.setValue(112 "Shortcuts/{0}/{1}/AltAccel".format(category, act.objectName()),113 act.alternateShortcut().toString())114def saveShortcuts(prefClass=Prefs):115 """116 Module function to write the keyboard shortcuts for the defined QActions.117 118 @param prefClass preferences class used as the storage area119 """120 # step 1: clear all previously saved shortcuts121 prefClass.settings.beginGroup("Shortcuts")122 prefClass.settings.remove("")123 prefClass.settings.endGroup()124 125 # step 2: save the various shortcuts126 for act in e5App().getObject("Project").getActions():127 __saveShortcut(act, "Project", prefClass)128 129 for act in e5App().getObject("UserInterface").getActions('ui'):130 __saveShortcut(act, "General", prefClass)131 132 for act in e5App().getObject("UserInterface").getActions('wizards'):133 __saveShortcut(act, "Wizards", prefClass)134 135 for act in e5App().getObject("DebugUI").getActions():136 __saveShortcut(act, "Debug", prefClass)137 138 for act in e5App().getObject("ViewManager").getActions('edit'):139 __saveShortcut(act, "Edit", prefClass)140 141 for act in e5App().getObject("ViewManager").getActions('file'):142 __saveShortcut(act, "File", prefClass)143 144 for act in e5App().getObject("ViewManager").getActions('search'):145 __saveShortcut(act, "Search", prefClass)146 147 for act in e5App().getObject("ViewManager").getActions('view'):148 __saveShortcut(act, "View", prefClass)149 150 for act in e5App().getObject("ViewManager").getActions('macro'):151 __saveShortcut(act, "Macro", prefClass)152 153 for act in e5App().getObject("ViewManager").getActions('bookmark'):154 __saveShortcut(act, "Bookmarks", prefClass)155 156 for act in e5App().getObject("ViewManager").getActions('spelling'):157 __saveShortcut(act, "Spelling", prefClass)158 159 actions = e5App().getObject("ViewManager").getActions('window')160 if actions:161 for act in actions:162 __saveShortcut(act, "Window", prefClass)163 164 for category, ref in e5App().getPluginObjects():165 if hasattr(ref, "getActions"):166 actions = ref.getActions()167 for act in actions:168 __saveShortcut(act, category, prefClass)169 170 try:171 for act in e5App().getObject("DummyHelpViewer").getActions():172 __saveShortcut(act, "HelpViewer", prefClass)173 except KeyError:174 # no QtWebKit available175 pass176def exportShortcuts(fn):177 """178 Module function to export the keyboard shortcuts for the defined QActions.179 180 @param fn filename of the export file (string)181 """182 # let the plugin manager create on demand plugin objects183 pm = e5App().getObject("PluginManager")184 pm.initOnDemandPlugins()185 186 f = QFile(fn)187 if f.open(QIODevice.WriteOnly):188 from E5XML.ShortcutsWriter import ShortcutsWriter189 ShortcutsWriter(f).writeXML()190 f.close()191 else:192 E5MessageBox.critical(193 None,194 QCoreApplication.translate(195 "Shortcuts", "Export Keyboard Shortcuts"),196 QCoreApplication.translate(197 "Shortcuts",198 "<p>The keyboard shortcuts could not be written to file"199 " <b>{0}</b>.</p>")200 .format(fn))201def importShortcuts(fn):202 """203 Module function to import the keyboard shortcuts for the defined E5Actions.204 205 @param fn filename of the import file (string)206 """207 # let the plugin manager create on demand plugin objects208 pm = e5App().getObject("PluginManager")209 pm.initOnDemandPlugins()210 211 f = QFile(fn)212 if f.open(QIODevice.ReadOnly):213 from E5XML.ShortcutsReader import ShortcutsReader214 reader = ShortcutsReader(f)215 reader.readXML()216 f.close()217 if not reader.hasError():218 shortcuts = reader.getShortcuts()219 setActions(shortcuts)220 saveShortcuts()221 syncPreferences()222 else:223 E5MessageBox.critical(224 None,225 QCoreApplication.translate(226 "Shortcuts", "Import Keyboard Shortcuts"),227 QCoreApplication.translate(228 "Shortcuts",229 "<p>The keyboard shortcuts could not be read from file"230 " <b>{0}</b>.</p>")231 .format(fn))232 return233def __setAction(actions, sdict):234 """235 Private function to write a single keyboard shortcut to the settings.236 237 @param actions list of actions to set (list of E5Action)238 @param sdict dictionary containg accelerator information for one category239 """240 for act in actions:241 if act.objectName():242 try:243 accel, altAccel = sdict[act.objectName()]244 act.setShortcut(QKeySequence(accel))245 act.setAlternateShortcut(QKeySequence(altAccel),246 removeEmpty=True)247 except KeyError:248 pass249def setActions(shortcuts):250 """251 Module function to set actions based on new format shortcuts file.252 253 @param shortcuts dictionary containing the accelerator information254 read from a XML file255 """256 if "Project" in shortcuts:257 __setAction(e5App().getObject("Project").getActions(),258 shortcuts["Project"])259 260 if "General" in shortcuts:261 __setAction(e5App().getObject("UserInterface").getActions('ui'),262 shortcuts["General"])263 264 if "Wizards" in shortcuts:265 __setAction(e5App().getObject("UserInterface").getActions('wizards'),266 shortcuts["Wizards"])267 268 if "Debug" in shortcuts:269 __setAction(e5App().getObject("DebugUI").getActions(),270 shortcuts["Debug"])271 272 if "Edit" in shortcuts:273 __setAction(e5App().getObject("ViewManager").getActions('edit'),274 shortcuts["Edit"])275 276 if "File" in shortcuts:277 __setAction(e5App().getObject("ViewManager").getActions('file'),278 shortcuts["File"])279 280 if "Search" in shortcuts:281 __setAction(e5App().getObject("ViewManager").getActions('search'),282 shortcuts["Search"])283 284 if "View" in shortcuts:285 __setAction(e5App().getObject("ViewManager").getActions('view'),286 shortcuts["View"])287 288 if "Macro" in shortcuts:289 __setAction(e5App().getObject("ViewManager").getActions('macro'),290 shortcuts["Macro"])291 292 if "Bookmarks" in shortcuts:293 __setAction(e5App().getObject("ViewManager").getActions('bookmark'),294 shortcuts["Bookmarks"])295 296 if "Spelling" in shortcuts:297 __setAction(e5App().getObject("ViewManager").getActions('spelling'),298 shortcuts["Spelling"])299 300 if "Window" in shortcuts:301 actions = e5App().getObject("ViewManager").getActions('window')302 if actions:303 __setAction(actions, shortcuts["Window"])304 305 for category, ref in e5App().getPluginObjects():306 if category in shortcuts and hasattr(ref, "getActions"):307 actions = ref.getActions()308 __setAction(actions, shortcuts[category])309 310 try:311 if "HelpViewer" in shortcuts:312 __setAction(e5App().getObject("DummyHelpViewer").getActions(),313 shortcuts["HelpViewer"])314 except KeyError:315 # no QtWebKit available...
websitePortfolioActions.test.js
Source:websitePortfolioActions.test.js
...22 type: actionTypes.TOGGLE_MENU_BUTTON23 }24 ];25 store.dispatch(Actions.toggleMenuButton());26 expect(store.getActions()).toEqual(expectedActions);27 expect(store.getActions()).toMatchSnapshot();28 });29 it('Dispatches the correct action and payload (menuButtonIsToggled)', () => {30 const expectedActions = [31 {32 type: actionTypes.MENU_BUTTON_IS_TOGGLED,33 val: true34 }35 ];36 store.dispatch(Actions.menuButtonIsToggled(true));37 expect(store.getActions()).toEqual(expectedActions);38 expect(store.getActions()).toMatchSnapshot();39 });40 it('Dispatches the correct action and payload (initServices)', () => {41 const expectedActions = [42 {43 type: actionTypes.INIT_SERVICES,44 array: [{a: 1, b: 2},{a: 1, b: 2}]45 }46 ];47 store.dispatch(Actions.initServices([{a: 1, b: 2},{a: 1, b: 2}]));48 expect(store.getActions()).toEqual(expectedActions);49 expect(store.getActions()).toMatchSnapshot();50 });51 it('Dispatches the correct action and payload (showCard)', () => {52 const expectedActions = [53 {54 type: actionTypes.SHOW_CARD,55 val: true56 }57 ];58 store.dispatch(Actions.showCard(true));59 expect(store.getActions()).toEqual(expectedActions);60 expect(store.getActions()).toMatchSnapshot();61 });62 63 it('Dispatches the correct action and payload (initTeamMembers)', () => {64 const expectedActions = [65 {66 type: actionTypes.INIT_TEAM_MEMBERS,67 array: [{a: 1, b: 2},{a: 1, b: 2}]68 }69 ];70 store.dispatch(Actions.initTeamMembers([{a: 1, b: 2},{a: 1, b: 2}]));71 expect(store.getActions()).toEqual(expectedActions);72 expect(store.getActions()).toMatchSnapshot();73 });74 it('Dispatches the correct action and payload (initImages)', () => {75 const expectedActions = [76 {77 type: actionTypes.INIT_IMAGES,78 array: [{a: 1, b: 2},{a: 1, b: 2}]79 }80 ];81 store.dispatch(Actions.initImages([{a: 1, b: 2},{a: 1, b: 2}]));82 expect(store.getActions()).toEqual(expectedActions);83 expect(store.getActions()).toMatchSnapshot();84 });85 it('Dispatches the correct action and payload (imageHover)', () => {86 const expectedActions = [87 {88 type: actionTypes.IMAGE_HOVER,89 id: 1,90 val: true91 }92 ];93 store.dispatch(Actions.imageHover(1, true));94 expect(store.getActions()).toEqual(expectedActions);95 expect(store.getActions()).toMatchSnapshot();96 });97 it('Dispatches the correct action and payload (feedbackOnChange)', () => {98 const expectedActions = [99 {100 type: actionTypes.FEEDBACK_ON_CHANGE101 }102 ];103 store.dispatch(Actions.feedbackOnChange());104 expect(store.getActions()).toEqual(expectedActions);105 expect(store.getActions()).toMatchSnapshot();106 });107 it('Dispatches the correct action and payload (dotOnChange)', () => {108 const expectedActions = [109 {110 type: actionTypes.DOTS_ON_CHANGE111 }112 ];113 store.dispatch(Actions.dotOnChange());114 expect(store.getActions()).toEqual(expectedActions);115 expect(store.getActions()).toMatchSnapshot();116 });117 it('Dispatches the correct action and payload (startChangingFeedbacks)', () => {118 const expectedActions = [119 {120 type: actionTypes.START_CHANGING_FEEDBACKS,121 dotId: 3,122 feedbackIndex: 2123 }124 ];125 store.dispatch(Actions.startChangingFeedbacks(3, 2));126 expect(store.getActions()).toEqual(expectedActions);127 expect(store.getActions()).toMatchSnapshot();128 });129 it('Dispatches the correct action and payload (stopChangingFeedbacks)', () => {130 const expectedActions = [131 {132 type: actionTypes.STOP_CHANGING_FEEDBACKS133 }134 ];135 store.dispatch(Actions.stopChangingFeedbacks(3, 2));136 expect(store.getActions()).toEqual(expectedActions);137 expect(store.getActions()).toMatchSnapshot();138 });139 it('Dispatches the correct action and payload (activateIcon)', () => {140 const expectedActions = [141 {142 type: actionTypes.ACTIVATE_ICON,143 id: 3144 }145 ];146 store.dispatch(Actions.activateIcon(3));147 expect(store.getActions()).toEqual(expectedActions);148 expect(store.getActions()).toMatchSnapshot();149 });150 it('Dispatches the correct action and payload (imageOnClick)', () => {151 const expectedActions = [152 {153 type: actionTypes.IMAGE_ON_CLICK,154 val: true,155 id: 2156 }157 ];158 store.dispatch(Actions.imageOnClick(true, 2));159 expect(store.getActions()).toEqual(expectedActions);160 expect(store.getActions()).toMatchSnapshot();161 });162 it('Dispatches the correct action and payload (nextImage)', () => {163 const expectedActions = [164 {165 type: actionTypes.NEXT_IMAGE,166 id: 2167 }168 ];169 store.dispatch(Actions.nextImage(2));170 expect(store.getActions()).toEqual(expectedActions);171 expect(store.getActions()).toMatchSnapshot();172 });173 it('Dispatches the correct action and payload (previousImage)', () => {174 const expectedActions = [175 {176 type: actionTypes.PREVIOUS_IMAGE,177 id: 4178 }179 ];180 store.dispatch(Actions.previousImage(4));181 expect(store.getActions()).toEqual(expectedActions);182 expect(store.getActions()).toMatchSnapshot();183 });184 it('Dispatches the correct action and payload (submitMessage)', () => {185 const expectedActions = [186 {187 type: actionTypes.SUBMIT_MESSAGE,188 name: "Humay",189 email: "qasimovahumay@gmail.com",190 contact: "012345678",191 company: "crypto347",192 message: "Hey"193 }194 ];195 store.dispatch(Actions.submitMessage("Humay", "qasimovahumay@gmail.com", "012345678", "crypto347", "Hey"));196 expect(store.getActions()).toEqual(expectedActions);197 expect(store.getActions()).toMatchSnapshot();198 });199 it('Dispatches the correct action and payload (messageToSend)', () => {200 const expectedActions = [201 {202 type: actionTypes.MESSAGE_TO_SEND,203 obj: {a: 1, b: "Hey"}204 }205 ];206 store.dispatch(Actions.messageToSend({a: 1, b: "Hey"}));207 expect(store.getActions()).toEqual(expectedActions);208 expect(store.getActions()).toMatchSnapshot();209 });...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!