Best JavaScript code snippet using storybook-test-runner
map-active.js
Source:map-active.js
1(function ($) {2 "use strict";3 4 5 $(".mapcontainer").mapael({6 map: {7 name: "world_countries",8 defaultArea: {9 attrs: {10 stroke: "#000",11 "stroke-width": 112 }13 }14 },15 legend: {16 plot: {17 slices: [18 {19 attrs: {20 fill: "#ff9999"21 },22 label: true,23 size: 3024 }25 ]26 }27 },28 plots: {29 'paris': {30 latitude: 48.86,31 longitude: 2.3444,32 value: 500000000,33 tooltip: {content: "Meeting In Paris"}34 }35 },36 areas: {37 "AF": {38 "value": "35320445",39 "attrs": {40 "href": "#"41 },42 "tooltip": {43 "content": "<span style=\"font-weight:bold;\">Afghanistan<\/span><br \/>Population : 35320445"44 }45 },46 "ZA": {47 "value": "50586757",48 "href": "#",49 "tooltip": {50 "content": "<span style=\"font-weight:bold;\">South Africa<\/span><br \/>Population : 50586757"51 }52 },53 "AL": {54 "value": "3215988",55 "href": "#",56 "tooltip": {57 "content": "<span style=\"font-weight:bold;\">Albania<\/span><br \/>Population : 3215988"58 }59 },60 "DZ": {61 "value": "35980193",62 "href": "#",63 "tooltip": {64 "content": "<span style=\"font-weight:bold;\">Algeria<\/span><br \/>Population : 35980193"65 }66 },67 "DE": {68 "value": "81726000",69 "href": "#",70 "tooltip": {71 "content": "<span style=\"font-weight:bold;\">Germany<\/span><br \/>Population : 81726000"72 }73 },74 "AD": {75 "value": "86165",76 "href": "#",77 "tooltip": {78 "content": "<span style=\"font-weight:bold;\">Andorra<\/span><br \/>Population : 86165"79 }80 },81 "AO": {82 "value": "19618432",83 "href": "#",84 "tooltip": {85 "content": "<span style=\"font-weight:bold;\">Angola<\/span><br \/>Population : 19618432"86 }87 },88 "AG": {89 "value": "89612",90 "href": "#",91 "tooltip": {92 "content": "<span style=\"font-weight:bold;\">Antigua And Barbuda<\/span><br \/>Population : 89612"93 }94 },95 "SA": {96 "value": "28082541",97 "href": "#",98 "tooltip": {99 "content": "<span style=\"font-weight:bold;\">Saudi Arabia<\/span><br \/>Population : 28082541"100 }101 },102 "AR": {103 "value": "40764561",104 "href": "#",105 "tooltip": {106 "content": "<span style=\"font-weight:bold;\">Argentina<\/span><br \/>Population : 40764561"107 }108 },109 "AM": {110 "value": "3100236",111 "href": "#",112 "tooltip": {113 "content": "<span style=\"font-weight:bold;\">Armenia<\/span><br \/>Population : 3100236"114 }115 },116 "AU": {117 "value": "22620600",118 "href": "#",119 "tooltip": {120 "content": "<span style=\"font-weight:bold;\">Australia<\/span><br \/>Population : 22620600"121 }122 },123 "AT": {124 "value": "8419000",125 "href": "#",126 "tooltip": {127 "content": "<span style=\"font-weight:bold;\">Austria<\/span><br \/>Population : 8419000"128 }129 },130 "AZ": {131 "value": "9168000",132 "href": "#",133 "tooltip": {134 "content": "<span style=\"font-weight:bold;\">Azerbaijan<\/span><br \/>Population : 9168000"135 }136 },137 "BS": {138 "value": "347176",139 "href": "#",140 "tooltip": {141 "content": "<span style=\"font-weight:bold;\">Bahamas<\/span><br \/>Population : 347176"142 }143 },144 "BH": {145 "value": "1323535",146 "href": "#",147 "tooltip": {148 "content": "<span style=\"font-weight:bold;\">Bahrain<\/span><br \/>Population : 1323535"149 }150 },151 "BD": {152 "value": "150493658",153 "href": "#",154 "tooltip": {155 "content": "<span style=\"font-weight:bold;\">Bangladesh<\/span><br \/>Population : 150493658"156 }157 },158 "BB": {159 "value": "273925",160 "href": "#",161 "tooltip": {162 "content": "<span style=\"font-weight:bold;\">Barbados<\/span><br \/>Population : 273925"163 }164 },165 "BE": {166 "value": "11008000",167 "href": "#",168 "tooltip": {169 "content": "<span style=\"font-weight:bold;\">Belgium<\/span><br \/>Population : 11008000"170 }171 },172 "BZ": {173 "value": "356600",174 "href": "#",175 "tooltip": {176 "content": "<span style=\"font-weight:bold;\">Belize<\/span><br \/>Population : 356600"177 }178 },179 "BJ": {180 "value": "9099922",181 "href": "#",182 "tooltip": {183 "content": "<span style=\"font-weight:bold;\">Benin<\/span><br \/>Population : 9099922"184 }185 },186 "BT": {187 "value": "738267",188 "href": "#",189 "tooltip": {190 "content": "<span style=\"font-weight:bold;\">Bhutan<\/span><br \/>Population : 738267"191 }192 },193 "BY": {194 "value": "9473000",195 "href": "#",196 "tooltip": {197 "content": "<span style=\"font-weight:bold;\">Belarus<\/span><br \/>Population : 9473000"198 }199 },200 "MM": {201 "value": "48336763",202 "href": "#",203 "tooltip": {204 "content": "<span style=\"font-weight:bold;\">Myanmar<\/span><br \/>Population : 48336763"205 }206 },207 "BO": {208 "value": "10088108",209 "href": "#",210 "tooltip": {211 "content": "<span style=\"font-weight:bold;\">Bolivia, Plurinational State Of<\/span><br \/>Population : 10088108"212 }213 },214 "BA": {215 "value": "3752228",216 "href": "#",217 "tooltip": {218 "content": "<span style=\"font-weight:bold;\">Bosnia And Herzegovina<\/span><br \/>Population : 3752228"219 }220 },221 "BW": {222 "value": "2030738",223 "href": "#",224 "tooltip": {225 "content": "<span style=\"font-weight:bold;\">Botswana<\/span><br \/>Population : 2030738"226 }227 },228 "BR": {229 "value": "196655014",230 "href": "#",231 "tooltip": {232 "content": "<span style=\"font-weight:bold;\">Brazil<\/span><br \/>Population : 196655014"233 }234 },235 "BN": {236 "value": "405938",237 "href": "#",238 "tooltip": {239 "content": "<span style=\"font-weight:bold;\">Brunei Darussalam<\/span><br \/>Population : 405938"240 }241 },242 "BG": {243 "value": "7476000",244 "href": "#",245 "tooltip": {246 "content": "<span style=\"font-weight:bold;\">Bulgaria<\/span><br \/>Population : 7476000"247 }248 },249 "BF": {250 "value": "16967845",251 "href": "#",252 "tooltip": {253 "content": "<span style=\"font-weight:bold;\">Burkina Faso<\/span><br \/>Population : 16967845"254 }255 },256 "BI": {257 "value": "8575172",258 "href": "#",259 "tooltip": {260 "content": "<span style=\"font-weight:bold;\">Burundi<\/span><br \/>Population : 8575172"261 }262 },263 "KH": {264 "value": "14305183",265 "href": "#",266 "tooltip": {267 "content": "<span style=\"font-weight:bold;\">Cambodia<\/span><br \/>Population : 14305183"268 }269 },270 "CM": {271 "value": "20030362",272 "href": "#",273 "tooltip": {274 "content": "<span style=\"font-weight:bold;\">Cameroon<\/span><br \/>Population : 20030362"275 }276 },277 "CA": {278 "value": "34482779",279 "href": "#",280 "tooltip": {281 "content": "<span style=\"font-weight:bold;\">Canada<\/span><br \/>Population : 34482779"282 }283 },284 "CV": {285 "value": "500585",286 "href": "#",287 "tooltip": {288 "content": "<span style=\"font-weight:bold;\">Cape Verde<\/span><br \/>Population : 500585"289 }290 },291 "CF": {292 "value": "4486837",293 "href": "#",294 "tooltip": {295 "content": "<span style=\"font-weight:bold;\">Central African Republic<\/span><br \/>Population : 4486837"296 }297 },298 "CL": {299 "value": "17269525",300 "href": "#",301 "tooltip": {302 "content": "<span style=\"font-weight:bold;\">Chile<\/span><br \/>Population : 17269525"303 }304 },305 "CN": {306 "value": "1344130000",307 "href": "#",308 "tooltip": {309 "content": "<span style=\"font-weight:bold;\">China<\/span><br \/>Population : 1344130000"310 }311 },312 "CY": {313 "value": "1116564",314 "href": "#",315 "tooltip": {316 "content": "<span style=\"font-weight:bold;\">Cyprus<\/span><br \/>Population : 1116564"317 }318 },319 "CO": {320 "value": "46927125",321 "href": "#",322 "tooltip": {323 "content": "<span style=\"font-weight:bold;\">Colombia<\/span><br \/>Population : 46927125"324 }325 },326 "KM": {327 "value": "753943",328 "href": "#",329 "tooltip": {330 "content": "<span style=\"font-weight:bold;\">Comoros<\/span><br \/>Population : 753943"331 }332 },333 "CG": {334 "value": "4139748",335 "href": "#",336 "tooltip": {337 "content": "<span style=\"font-weight:bold;\">Congo<\/span><br \/>Population : 4139748"338 }339 },340 "CD": {341 "value": "67757577",342 "href": "#",343 "tooltip": {344 "content": "<span style=\"font-weight:bold;\">Congo, The Democratic Republic Of The<\/span><br \/>Population : 67757577"345 }346 },347 "KP": {348 "value": "24451285",349 "href": "#",350 "tooltip": {351 "content": "<span style=\"font-weight:bold;\">Korea, Democratic People's Republic Of<\/span><br \/>Population : 24451285"352 }353 },354 "KR": {355 "value": "49779000",356 "href": "#",357 "tooltip": {358 "content": "<span style=\"font-weight:bold;\">Korea, Republic Of<\/span><br \/>Population : 49779000"359 }360 },361 "CR": {362 "value": "4726575",363 "href": "#",364 "tooltip": {365 "content": "<span style=\"font-weight:bold;\">Costa Rica<\/span><br \/>Population : 4726575"366 }367 },368 "CI": {369 "value": "20152894",370 "href": "#",371 "tooltip": {372 "content": "<span style=\"font-weight:bold;\">C\u00d4te D'ivoire<\/span><br \/>Population : 20152894"373 }374 },375 "HR": {376 "value": "4407000",377 "href": "#",378 "tooltip": {379 "content": "<span style=\"font-weight:bold;\">Croatia<\/span><br \/>Population : 4407000"380 }381 },382 "CU": {383 "value": "11253665",384 "href": "#",385 "tooltip": {386 "content": "<span style=\"font-weight:bold;\">Cuba<\/span><br \/>Population : 11253665"387 }388 },389 "DK": {390 "value": "5574000",391 "href": "#",392 "tooltip": {393 "content": "<span style=\"font-weight:bold;\">Denmark<\/span><br \/>Population : 5574000"394 }395 },396 "DJ": {397 "value": "905564",398 "href": "#",399 "tooltip": {400 "content": "<span style=\"font-weight:bold;\">Djibouti<\/span><br \/>Population : 905564"401 }402 },403 "DM": {404 "value": "67675",405 "href": "#",406 "tooltip": {407 "content": "<span style=\"font-weight:bold;\">Dominica<\/span><br \/>Population : 67675"408 }409 },410 "EG": {411 "value": "82536770",412 "href": "#",413 "tooltip": {414 "content": "<span style=\"font-weight:bold;\">Egypt<\/span><br \/>Population : 82536770"415 }416 },417 "AE": {418 "value": "7890924",419 "href": "#",420 "tooltip": {421 "content": "<span style=\"font-weight:bold;\">United Arab Emirates<\/span><br \/>Population : 7890924"422 }423 },424 "EC": {425 "value": "14666055",426 "href": "#",427 "tooltip": {428 "content": "<span style=\"font-weight:bold;\">Ecuador<\/span><br \/>Population : 14666055"429 }430 },431 "ER": {432 "value": "5415280",433 "href": "#",434 "tooltip": {435 "content": "<span style=\"font-weight:bold;\">Eritrea<\/span><br \/>Population : 5415280"436 }437 },438 "ES": {439 "value": "46235000",440 "href": "#",441 "tooltip": {442 "content": "<span style=\"font-weight:bold;\">Spain<\/span><br \/>Population : 46235000"443 }444 },445 "EE": {446 "value": "1340000",447 "href": "#",448 "tooltip": {449 "content": "<span style=\"font-weight:bold;\">Estonia<\/span><br \/>Population : 1340000"450 }451 },452 "US": {453 "value": "311591917",454 "href": "#",455 "tooltip": {456 "content": "<span style=\"font-weight:bold;\">United States<\/span><br \/>Population : 311591917"457 }458 },459 "ET": {460 "value": "84734262",461 "href": "#",462 "tooltip": {463 "content": "<span style=\"font-weight:bold;\">Ethiopia<\/span><br \/>Population : 84734262"464 }465 },466 "FJ": {467 "value": "868406",468 "href": "#",469 "tooltip": {470 "content": "<span style=\"font-weight:bold;\">Fiji<\/span><br \/>Population : 868406"471 }472 },473 "FI": {474 "value": "5387000",475 "href": "#",476 "tooltip": {477 "content": "<span style=\"font-weight:bold;\">Finland<\/span><br \/>Population : 5387000"478 }479 },480 "FR": {481 "value": "65436552",482 "href": "#",483 "tooltip": {484 "content": "<span style=\"font-weight:bold;\">France<\/span><br \/>Population : 65436552"485 }486 },487 "GA": {488 "value": "1534262",489 "href": "#",490 "tooltip": {491 "content": "<span style=\"font-weight:bold;\">Gabon<\/span><br \/>Population : 1534262"492 }493 },494 "GM": {495 "value": "1776103",496 "href": "#",497 "tooltip": {498 "content": "<span style=\"font-weight:bold;\">Gambia<\/span><br \/>Population : 1776103"499 }500 },501 "GE": {502 "value": "4486000",503 "href": "#",504 "tooltip": {505 "content": "<span style=\"font-weight:bold;\">Georgia<\/span><br \/>Population : 4486000"506 }507 },508 "GH": {509 "value": "24965816",510 "href": "#",511 "tooltip": {512 "content": "<span style=\"font-weight:bold;\">Ghana<\/span><br \/>Population : 24965816"513 }514 },515 "GR": {516 "value": "11304000",517 "href": "#",518 "tooltip": {519 "content": "<span style=\"font-weight:bold;\">Greece<\/span><br \/>Population : 11304000"520 }521 },522 "GD": {523 "value": "104890",524 "href": "#",525 "tooltip": {526 "content": "<span style=\"font-weight:bold;\">Grenada<\/span><br \/>Population : 104890"527 }528 },529 "GT": {530 "value": "14757316",531 "href": "#",532 "tooltip": {533 "content": "<span style=\"font-weight:bold;\">Guatemala<\/span><br \/>Population : 14757316"534 }535 },536 "GN": {537 "value": "10221808",538 "href": "#",539 "tooltip": {540 "content": "<span style=\"font-weight:bold;\">Guinea<\/span><br \/>Population : 10221808"541 }542 },543 "GQ": {544 "value": "720213",545 "href": "#",546 "tooltip": {547 "content": "<span style=\"font-weight:bold;\">Equatorial Guinea<\/span><br \/>Population : 720213"548 }549 },550 "GW": {551 "value": "1547061",552 "href": "#",553 "tooltip": {554 "content": "<span style=\"font-weight:bold;\">Guinea-bissau<\/span><br \/>Population : 1547061"555 }556 },557 "GY": {558 "value": "756040",559 "href": "#",560 "tooltip": {561 "content": "<span style=\"font-weight:bold;\">Guyana<\/span><br \/>Population : 756040"562 }563 },564 "HT": {565 "value": "10123787",566 "href": "#",567 "tooltip": {568 "content": "<span style=\"font-weight:bold;\">Haiti<\/span><br \/>Population : 10123787"569 }570 },571 "HN": {572 "value": "7754687",573 "href": "#",574 "tooltip": {575 "content": "<span style=\"font-weight:bold;\">Honduras<\/span><br \/>Population : 7754687"576 }577 },578 "HU": {579 "value": "9971000",580 "href": "#",581 "tooltip": {582 "content": "<span style=\"font-weight:bold;\">Hungary<\/span><br \/>Population : 9971000"583 }584 },585 "JM": {586 "value": "2709300",587 "href": "#",588 "tooltip": {589 "content": "<span style=\"font-weight:bold;\">Jamaica<\/span><br \/>Population : 2709300"590 }591 },592 "JP": {593 "value": "127817277",594 "href": "#",595 "tooltip": {596 "content": "<span style=\"font-weight:bold;\">Japan<\/span><br \/>Population : 127817277"597 }598 },599 "MH": {600 "value": "54816",601 "href": "#",602 "tooltip": {603 "content": "<span style=\"font-weight:bold;\">Marshall Islands<\/span><br \/>Population : 54816"604 }605 },606 "PW": {607 "value": "20609",608 "href": "#",609 "tooltip": {610 "content": "<span style=\"font-weight:bold;\">Palau<\/span><br \/>Population : 20609"611 }612 },613 "SB": {614 "value": "552267",615 "href": "#",616 "tooltip": {617 "content": "<span style=\"font-weight:bold;\">Solomon Islands<\/span><br \/>Population : 552267"618 }619 },620 "IN": {621 "value": "1241491960",622 "href": "#",623 "tooltip": {624 "content": "<span style=\"font-weight:bold;\">India<\/span><br \/>Population : 1241491960"625 }626 },627 "ID": {628 "value": "242325638",629 "href": "#",630 "tooltip": {631 "content": "<span style=\"font-weight:bold;\">Indonesia<\/span><br \/>Population : 242325638"632 }633 },634 "JO": {635 "value": "6181000",636 "href": "#",637 "tooltip": {638 "content": "<span style=\"font-weight:bold;\">Jordan<\/span><br \/>Population : 6181000"639 }640 },641 "IR": {642 "value": "74798599",643 "href": "#",644 "tooltip": {645 "content": "<span style=\"font-weight:bold;\">Iran, Islamic Republic Of<\/span><br \/>Population : 74798599"646 }647 },648 "IQ": {649 "value": "32961959",650 "href": "#",651 "tooltip": {652 "content": "<span style=\"font-weight:bold;\">Iraq<\/span><br \/>Population : 32961959"653 }654 },655 "IE": {656 "value": "4487000",657 "href": "#",658 "tooltip": {659 "content": "<span style=\"font-weight:bold;\">Ireland<\/span><br \/>Population : 4487000"660 }661 },662 "IS": {663 "value": "319000",664 "href": "#",665 "tooltip": {666 "content": "<span style=\"font-weight:bold;\">Iceland<\/span><br \/>Population : 319000"667 }668 },669 "IL": {670 "value": "7765700",671 "href": "#",672 "tooltip": {673 "content": "<span style=\"font-weight:bold;\">Israel<\/span><br \/>Population : 7765700"674 }675 },676 "IT": {677 "value": "60770000",678 "href": "#",679 "tooltip": {680 "content": "<span style=\"font-weight:bold;\">Italy<\/span><br \/>Population : 60770000"681 }682 },683 "KZ": {684 "value": "16558459",685 "href": "#",686 "tooltip": {687 "content": "<span style=\"font-weight:bold;\">Kazakhstan<\/span><br \/>Population : 16558459"688 }689 },690 "KE": {691 "value": "41609728",692 "href": "#",693 "tooltip": {694 "content": "<span style=\"font-weight:bold;\">Kenya<\/span><br \/>Population : 41609728"695 }696 },697 "KG": {698 "value": "5507000",699 "href": "#",700 "tooltip": {701 "content": "<span style=\"font-weight:bold;\">Kyrgyzstan<\/span><br \/>Population : 5507000"702 }703 },704 "KI": {705 "value": "101093",706 "href": "#",707 "tooltip": {708 "content": "<span style=\"font-weight:bold;\">Kiribati<\/span><br \/>Population : 101093"709 }710 },711 "KW": {712 "value": "2818042",713 "href": "#",714 "tooltip": {715 "content": "<span style=\"font-weight:bold;\">Kuwait<\/span><br \/>Population : 2818042"716 }717 },718 "LA": {719 "value": "6288037",720 "href": "#",721 "tooltip": {722 "content": "<span style=\"font-weight:bold;\">Lao People's Democratic Republic<\/span><br \/>Population : 6288037"723 }724 },725 "LS": {726 "value": "2193843",727 "href": "#",728 "tooltip": {729 "content": "<span style=\"font-weight:bold;\">Lesotho<\/span><br \/>Population : 2193843"730 }731 },732 "LV": {733 "value": "2220000",734 "href": "#",735 "tooltip": {736 "content": "<span style=\"font-weight:bold;\">Latvia<\/span><br \/>Population : 2220000"737 }738 },739 "LB": {740 "value": "4259405",741 "href": "#",742 "tooltip": {743 "content": "<span style=\"font-weight:bold;\">Lebanon<\/span><br \/>Population : 4259405"744 }745 },746 "LR": {747 "value": "4128572",748 "href": "#",749 "tooltip": {750 "content": "<span style=\"font-weight:bold;\">Liberia<\/span><br \/>Population : 4128572"751 }752 },753 "LY": {754 "value": "6422772",755 "href": "#",756 "tooltip": {757 "content": "<span style=\"font-weight:bold;\">Libya<\/span><br \/>Population : 6422772"758 }759 },760 "LI": {761 "value": "36304",762 "href": "#",763 "tooltip": {764 "content": "<span style=\"font-weight:bold;\">Liechtenstein<\/span><br \/>Population : 36304"765 }766 },767 "LT": {768 "value": "3203000",769 "href": "#",770 "tooltip": {771 "content": "<span style=\"font-weight:bold;\">Lithuania<\/span><br \/>Population : 3203000"772 }773 },774 "LU": {775 "value": "517000",776 "href": "#",777 "tooltip": {778 "content": "<span style=\"font-weight:bold;\">Luxembourg<\/span><br \/>Population : 517000"779 }780 },781 "MK": {782 "value": "2063893",783 "href": "#",784 "tooltip": {785 "content": "<span style=\"font-weight:bold;\">Macedonia, The Former Yugoslav Republic Of<\/span><br \/>Population : 2063893"786 }787 },788 "MG": {789 "value": "21315135",790 "href": "#",791 "tooltip": {792 "content": "<span style=\"font-weight:bold;\">Madagascar<\/span><br \/>Population : 21315135"793 }794 },795 "MY": {796 "value": "28859154",797 "href": "#",798 "tooltip": {799 "content": "<span style=\"font-weight:bold;\">Malaysia<\/span><br \/>Population : 28859154"800 }801 },802 "MW": {803 "value": "15380888",804 "href": "#",805 "tooltip": {806 "content": "<span style=\"font-weight:bold;\">Malawi<\/span><br \/>Population : 15380888"807 }808 },809 "MV": {810 "value": "320081",811 "href": "#",812 "tooltip": {813 "content": "<span style=\"font-weight:bold;\">Maldives<\/span><br \/>Population : 320081"814 }815 },816 "ML": {817 "value": "15839538",818 "href": "#",819 "tooltip": {820 "content": "<span style=\"font-weight:bold;\">Mali<\/span><br \/>Population : 15839538"821 }822 },823 "MT": {824 "value": "419000",825 "href": "#",826 "tooltip": {827 "content": "<span style=\"font-weight:bold;\">Malta<\/span><br \/>Population : 419000"828 }829 },830 "MA": {831 "value": "32272974",832 "href": "#",833 "tooltip": {834 "content": "<span style=\"font-weight:bold;\">Morocco<\/span><br \/>Population : 32272974"835 }836 },837 "MU": {838 "value": "1286051",839 "href": "#",840 "tooltip": {841 "content": "<span style=\"font-weight:bold;\">Mauritius<\/span><br \/>Population : 1286051"842 }843 },844 "MR": {845 "value": "3541540",846 "href": "#",847 "tooltip": {848 "content": "<span style=\"font-weight:bold;\">Mauritania<\/span><br \/>Population : 3541540"849 }850 },851 "MX": {852 "value": "114793341",853 "href": "#",854 "tooltip": {855 "content": "<span style=\"font-weight:bold;\">Mexico<\/span><br \/>Population : 114793341"856 }857 },858 "FM": {859 "value": "111542",860 "href": "#",861 "tooltip": {862 "content": "<span style=\"font-weight:bold;\">Micronesia, Federated States Of<\/span><br \/>Population : 111542"863 }864 },865 "MD": {866 "value": "3559000",867 "href": "#",868 "tooltip": {869 "content": "<span style=\"font-weight:bold;\">Moldova, Republic Of<\/span><br \/>Population : 3559000"870 }871 },872 "MC": {873 "value": "35427",874 "href": "#",875 "tooltip": {876 "content": "<span style=\"font-weight:bold;\">Monaco<\/span><br \/>Population : 35427"877 }878 },879 "MN": {880 "value": "2800114",881 "href": "#",882 "tooltip": {883 "content": "<span style=\"font-weight:bold;\">Mongolia<\/span><br \/>Population : 2800114"884 }885 },886 "ME": {887 "value": "632261",888 "href": "#",889 "tooltip": {890 "content": "<span style=\"font-weight:bold;\">Montenegro<\/span><br \/>Population : 632261"891 }892 },893 "MZ": {894 "value": "23929708",895 "href": "#",896 "tooltip": {897 "content": "<span style=\"font-weight:bold;\">Mozambique<\/span><br \/>Population : 23929708"898 }899 },900 "NA": {901 "value": "2324004",902 "href": "#",903 "tooltip": {904 "content": "<span style=\"font-weight:bold;\">Namibia<\/span><br \/>Population : 2324004"905 }906 },907 "NP": {908 "value": "30485798",909 "href": "#",910 "tooltip": {911 "content": "<span style=\"font-weight:bold;\">Nepal<\/span><br \/>Population : 30485798"912 }913 },914 "NI": {915 "value": "5869859",916 "href": "#",917 "tooltip": {918 "content": "<span style=\"font-weight:bold;\">Nicaragua<\/span><br \/>Population : 5869859"919 }920 },921 "NE": {922 "value": "16068994",923 "href": "#",924 "tooltip": {925 "content": "<span style=\"font-weight:bold;\">Niger<\/span><br \/>Population : 16068994"926 }927 },928 "NG": {929 "value": "162470737",930 "href": "#",931 "tooltip": {932 "content": "<span style=\"font-weight:bold;\">Nigeria<\/span><br \/>Population : 162470737"933 }934 },935 "NO": {936 "value": "4952000",937 "href": "#",938 "tooltip": {939 "content": "<span style=\"font-weight:bold;\">Norway<\/span><br \/>Population : 4952000"940 }941 },942 "NZ": {943 "value": "4405200",944 "href": "#",945 "tooltip": {946 "content": "<span style=\"font-weight:bold;\">New Zealand<\/span><br \/>Population : 4405200"947 }948 },949 "OM": {950 "value": "2846145",951 "href": "#",952 "tooltip": {953 "content": "<span style=\"font-weight:bold;\">Oman<\/span><br \/>Population : 2846145"954 }955 },956 "UG": {957 "value": "34509205",958 "href": "#",959 "tooltip": {960 "content": "<span style=\"font-weight:bold;\">Uganda<\/span><br \/>Population : 34509205"961 }962 },963 "UZ": {964 "value": "29341200",965 "href": "#",966 "tooltip": {967 "content": "<span style=\"font-weight:bold;\">Uzbekistan<\/span><br \/>Population : 29341200"968 }969 },970 "PK": {971 "value": "176745364",972 "href": "#",973 "tooltip": {974 "content": "<span style=\"font-weight:bold;\">Pakistan<\/span><br \/>Population : 176745364"975 }976 },977 "PS": {978 "value": "4019433",979 "href": "#",980 "tooltip": {981 "content": "<span style=\"font-weight:bold;\">Palestine, State Of<\/span><br \/>Population : 4019433"982 }983 },984 "PA": {985 "value": "3571185",986 "href": "#",987 "tooltip": {988 "content": "<span style=\"font-weight:bold;\">Panama<\/span><br \/>Population : 3571185"989 }990 },991 "PG": {992 "value": "7013829",993 "href": "#",994 "tooltip": {995 "content": "<span style=\"font-weight:bold;\">Papua New Guinea<\/span><br \/>Population : 7013829"996 }997 },998 "PY": {999 "value": "6568290",1000 "href": "#",1001 "tooltip": {1002 "content": "<span style=\"font-weight:bold;\">Paraguay<\/span><br \/>Population : 6568290"1003 }1004 },1005 "NL": {1006 "value": "16696000",1007 "href": "#",1008 "tooltip": {1009 "content": "<span style=\"font-weight:bold;\">Netherlands<\/span><br \/>Population : 16696000"1010 }1011 },1012 "PE": {1013 "value": "29399817",1014 "href": "#",1015 "tooltip": {1016 "content": "<span style=\"font-weight:bold;\">Peru<\/span><br \/>Population : 29399817"1017 }1018 },1019 "PH": {1020 "value": "94852030",1021 "href": "#",1022 "tooltip": {1023 "content": "<span style=\"font-weight:bold;\">Philippines<\/span><br \/>Population : 94852030"1024 }1025 },1026 "PL": {1027 "value": "38216000",1028 "href": "#",1029 "tooltip": {1030 "content": "<span style=\"font-weight:bold;\">Poland<\/span><br \/>Population : 38216000"1031 }1032 },1033 "PT": {1034 "value": "10637000",1035 "href": "#",1036 "tooltip": {1037 "content": "<span style=\"font-weight:bold;\">Portugal<\/span><br \/>Population : 10637000"1038 }1039 },1040 "QA": {1041 "value": "1870041",1042 "href": "#",1043 "tooltip": {1044 "content": "<span style=\"font-weight:bold;\">Qatar<\/span><br \/>Population : 1870041"1045 }1046 },1047 "DO": {1048 "value": "10056181",1049 "href": "#",1050 "tooltip": {1051 "content": "<span style=\"font-weight:bold;\">Dominican Republic<\/span><br \/>Population : 10056181"1052 }1053 },1054 "RO": {1055 "value": "21390000",1056 "href": "#",1057 "tooltip": {1058 "content": "<span style=\"font-weight:bold;\">Romania<\/span><br \/>Population : 21390000"1059 }1060 },1061 "GB": {1062 "value": "62641000",1063 "href": "#",1064 "tooltip": {1065 "content": "<span style=\"font-weight:bold;\">United Kingdom<\/span><br \/>Population : 62641000"1066 }1067 },1068 "RU": {1069 "value": "141930000",1070 "href": "#",1071 "tooltip": {1072 "content": "<span style=\"font-weight:bold;\">Russian Federation<\/span><br \/>Population : 141930000"1073 }1074 },1075 "RW": {1076 "value": "10942950",1077 "href": "#",1078 "tooltip": {1079 "content": "<span style=\"font-weight:bold;\">Rwanda<\/span><br \/>Population : 10942950"1080 }1081 },1082 "KN": {1083 "value": "53051",1084 "href": "#",1085 "tooltip": {1086 "content": "<span style=\"font-weight:bold;\">Saint Kitts And Nevis<\/span><br \/>Population : 53051"1087 }1088 },1089 "SM": {1090 "value": "31735",1091 "href": "#",1092 "tooltip": {1093 "content": "<span style=\"font-weight:bold;\">San Marino<\/span><br \/>Population : 31735"1094 }1095 },1096 "VC": {1097 "value": "109365",1098 "href": "#",1099 "tooltip": {1100 "content": "<span style=\"font-weight:bold;\">Saint Vincent And The Grenadines<\/span><br \/>Population : 109365"1101 }1102 },1103 "LC": {1104 "value": "176000",1105 "href": "#",1106 "tooltip": {1107 "content": "<span style=\"font-weight:bold;\">Saint Lucia<\/span><br \/>Population : 176000"1108 }1109 },1110 "SV": {1111 "value": "6227491",1112 "href": "#",1113 "tooltip": {1114 "content": "<span style=\"font-weight:bold;\">El Salvador<\/span><br \/>Population : 6227491"1115 }1116 },1117 "WS": {1118 "value": "183874",1119 "href": "#",1120 "tooltip": {1121 "content": "<span style=\"font-weight:bold;\">Samoa<\/span><br \/>Population : 183874"1122 }1123 },1124 "ST": {1125 "value": "168526",1126 "href": "#",1127 "tooltip": {1128 "content": "<span style=\"font-weight:bold;\">Sao Tome And Principe<\/span><br \/>Population : 168526"1129 }1130 },1131 "SN": {1132 "value": "12767556",1133 "href": "#",1134 "tooltip": {1135 "content": "<span style=\"font-weight:bold;\">Senegal<\/span><br \/>Population : 12767556"1136 }1137 },1138 "RS": {1139 "value": "7261000",1140 "href": "#",1141 "tooltip": {1142 "content": "<span style=\"font-weight:bold;\">Serbia<\/span><br \/>Population : 7261000"1143 }1144 },1145 "SC": {1146 "value": "86000",1147 "href": "#",1148 "tooltip": {1149 "content": "<span style=\"font-weight:bold;\">Seychelles<\/span><br \/>Population : 86000"1150 }1151 },1152 "SL": {1153 "value": "5997486",1154 "href": "#",1155 "tooltip": {1156 "content": "<span style=\"font-weight:bold;\">Sierra Leone<\/span><br \/>Population : 5997486"1157 }1158 },1159 "SG": {1160 "value": "5183700",1161 "href": "#",1162 "tooltip": {1163 "content": "<span style=\"font-weight:bold;\">Singapore<\/span><br \/>Population : 5183700"1164 }1165 },1166 "SK": {1167 "value": "5440000",1168 "href": "#",1169 "tooltip": {1170 "content": "<span style=\"font-weight:bold;\">Slovakia<\/span><br \/>Population : 5440000"1171 }1172 },1173 "SI": {1174 "value": "2052000",1175 "href": "#",1176 "tooltip": {1177 "content": "<span style=\"font-weight:bold;\">Slovenia<\/span><br \/>Population : 2052000"1178 }1179 },1180 "SO": {1181 "value": "9556873",1182 "href": "#",1183 "tooltip": {1184 "content": "<span style=\"font-weight:bold;\">Somalia<\/span><br \/>Population : 9556873"1185 }1186 },1187 "SD": {1188 "value": "34318385",1189 "href": "#",1190 "tooltip": {1191 "content": "<span style=\"font-weight:bold;\">Sudan<\/span><br \/>Population : 34318385"1192 }1193 },1194 "SS": {1195 "value": "10314021",1196 "href": "#",1197 "tooltip": {1198 "content": "<span style=\"font-weight:bold;\">South Sudan<\/span><br \/>Population : 10314021"1199 }1200 },1201 "LK": {1202 "value": "20869000",1203 "href": "#",1204 "tooltip": {1205 "content": "<span style=\"font-weight:bold;\">Sri Lanka<\/span><br \/>Population : 20869000"1206 }1207 },1208 "SE": {1209 "value": "9453000",1210 "href": "#",1211 "tooltip": {1212 "content": "<span style=\"font-weight:bold;\">Sweden<\/span><br \/>Population : 9453000"1213 }1214 },1215 "CH": {1216 "value": "7907000",1217 "href": "#",1218 "tooltip": {1219 "content": "<span style=\"font-weight:bold;\">Switzerland<\/span><br \/>Population : 7907000"1220 }1221 },1222 "SR": {1223 "value": "529419",1224 "href": "#",1225 "tooltip": {1226 "content": "<span style=\"font-weight:bold;\">Suriname<\/span><br \/>Population : 529419"1227 }1228 },1229 "SZ": {1230 "value": "1067773",1231 "href": "#",1232 "tooltip": {1233 "content": "<span style=\"font-weight:bold;\">Swaziland<\/span><br \/>Population : 1067773"1234 }1235 },1236 "SY": {1237 "value": "20820311",1238 "href": "#",1239 "tooltip": {1240 "content": "<span style=\"font-weight:bold;\">Syrian Arab Republic<\/span><br \/>Population : 20820311"1241 }1242 },1243 "TJ": {1244 "value": "6976958",1245 "href": "#",1246 "tooltip": {1247 "content": "<span style=\"font-weight:bold;\">Tajikistan<\/span><br \/>Population : 6976958"1248 }1249 },1250 "TZ": {1251 "value": "46218486",1252 "href": "#",1253 "tooltip": {1254 "content": "<span style=\"font-weight:bold;\">Tanzania, United Republic Of<\/span><br \/>Population : 46218486"1255 }1256 },1257 "TD": {1258 "value": "11525496",1259 "href": "#",1260 "tooltip": {1261 "content": "<span style=\"font-weight:bold;\">Chad<\/span><br \/>Population : 11525496"1262 }1263 },1264 "CZ": {1265 "value": "10546000",1266 "href": "#",1267 "tooltip": {1268 "content": "<span style=\"font-weight:bold;\">Czech Republic<\/span><br \/>Population : 10546000"1269 }1270 },1271 "TH": {1272 "value": "69518555",1273 "href": "#",1274 "tooltip": {1275 "content": "<span style=\"font-weight:bold;\">Thailand<\/span><br \/>Population : 69518555"1276 }1277 },1278 "TL": {1279 "value": "1175880",1280 "href": "#",1281 "tooltip": {1282 "content": "<span style=\"font-weight:bold;\">Timor-leste<\/span><br \/>Population : 1175880"1283 }1284 },1285 "TG": {1286 "value": "6154813",1287 "href": "#",1288 "tooltip": {1289 "content": "<span style=\"font-weight:bold;\">Togo<\/span><br \/>Population : 6154813"1290 }1291 },1292 "TO": {1293 "value": "104509",1294 "href": "#",1295 "tooltip": {1296 "content": "<span style=\"font-weight:bold;\">Tonga<\/span><br \/>Population : 104509"1297 }1298 },1299 "TT": {1300 "value": "1346350",1301 "href": "#",1302 "tooltip": {1303 "content": "<span style=\"font-weight:bold;\">Trinidad And Tobago<\/span><br \/>Population : 1346350"1304 }1305 },1306 "TN": {1307 "value": "10673800",1308 "href": "#",1309 "tooltip": {1310 "content": "<span style=\"font-weight:bold;\">Tunisia<\/span><br \/>Population : 10673800"1311 }1312 },1313 "TM": {1314 "value": "5105301",1315 "href": "#",1316 "tooltip": {1317 "content": "<span style=\"font-weight:bold;\">Turkmenistan<\/span><br \/>Population : 5105301"1318 }1319 },1320 "TR": {1321 "value": "73639596",1322 "href": "#",1323 "tooltip": {1324 "content": "<span style=\"font-weight:bold;\">Turkey<\/span><br \/>Population : 73639596"1325 }1326 },1327 "TV": {1328 "value": "9847",1329 "href": "#",1330 "tooltip": {1331 "content": "<span style=\"font-weight:bold;\">Tuvalu<\/span><br \/>Population : 9847"1332 }1333 },1334 "VU": {1335 "value": "245619",1336 "href": "#",1337 "tooltip": {1338 "content": "<span style=\"font-weight:bold;\">Vanuatu<\/span><br \/>Population : 245619"1339 }1340 },1341 "VE": {1342 "value": "29278000",1343 "href": "#",1344 "tooltip": {1345 "content": "<span style=\"font-weight:bold;\">Venezuela, Bolivarian Republic Of<\/span><br \/>Population : 29278000"1346 }1347 },1348 "VN": {1349 "value": "87840000",1350 "href": "#",1351 "tooltip": {1352 "content": "<span style=\"font-weight:bold;\">Viet Nam<\/span><br \/>Population : 87840000"1353 }1354 },1355 "UA": {1356 "value": "45706100",1357 "href": "#",1358 "tooltip": {1359 "content": "<span style=\"font-weight:bold;\">Ukraine<\/span><br \/>Population : 45706100"1360 }1361 },1362 "UY": {1363 "value": "3368595",1364 "href": "#",1365 "tooltip": {1366 "content": "<span style=\"font-weight:bold;\">Uruguay<\/span><br \/>Population : 3368595"1367 }1368 },1369 "YE": {1370 "value": "24799880",1371 "href": "#",1372 "tooltip": {1373 "content": "<span style=\"font-weight:bold;\">Yemen<\/span><br \/>Population : 24799880"1374 }1375 },1376 "ZM": {1377 "value": "13474959",1378 "href": "#",1379 "tooltip": {1380 "content": "<span style=\"font-weight:bold;\">Zambia<\/span><br \/>Population : 13474959"1381 }1382 },1383 "ZW": {1384 "value": "12754378",1385 "href": "#",1386 "tooltip": {1387 "content": "<span style=\"font-weight:bold;\">Zimbabwe<\/span><br \/>Population : 12754378"1388 }1389 }1390 }1391 });...
renderer_test.js
Source:renderer_test.js
1// Copyright 2010 The Closure Library Authors. All Rights Reserved.2//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.14goog.provide('goog.ui.ac.RendererTest');15goog.setTestOnly('goog.ui.ac.RendererTest');16goog.require('goog.a11y.aria');17goog.require('goog.a11y.aria.Role');18goog.require('goog.a11y.aria.State');19goog.require('goog.dom');20goog.require('goog.dom.classlist');21goog.require('goog.events');22goog.require('goog.fx.dom.FadeInAndShow');23goog.require('goog.fx.dom.FadeOutAndHide');24goog.require('goog.string');25goog.require('goog.style');26goog.require('goog.testing.PropertyReplacer');27goog.require('goog.testing.jsunit');28goog.require('goog.ui.ac.AutoComplete');29goog.require('goog.ui.ac.Renderer');30var renderer;31var rendRows = [];32var someElement;33var target;34var viewport;35var viewportTarget;36var propertyReplacer;37function setUpPage() {38 someElement = goog.dom.getElement('someElement');39 target = goog.dom.getElement('target');40 viewport = goog.dom.getElement('viewport');41 viewportTarget = goog.dom.getElement('viewportTarget');42 propertyReplacer = new goog.testing.PropertyReplacer();43}44// One-time set up of rows formatted for the renderer.45var rows = [46 'Amanda Annie Anderson',47 'Frankie Manning',48 'Louis D Armstrong',49 // NOTE(user): sorry about this test input, but it has caused problems50 // in the past, so I want to make sure to test against it.51 'Foo Bar................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................',52 '<div><div>test</div></div>',53 '<div><div>test1</div><div>test2</div></div>',54 '<div>random test string<div>test1</div><div><div>test2</div><div>test3</div></div></div>'55];56for (var i = 0; i < rows.length; i++) {57 rendRows.push({58 id: i,59 data: rows[i]60 });61}62function setUp() {63 renderer = new goog.ui.ac.Renderer();64 renderer.rowDivs_ = [];65 renderer.target_ = target;66}67function tearDown() {68 renderer.dispose();69 propertyReplacer.reset();70}71function testBasicMatchingWithHtmlRow() {72 // '<div><div>test</div></div>'73 var row = rendRows[4];74 var token = 'te';75 enableHtmlRendering(renderer);76 var node = renderer.renderRowHtml(row, token);77 var boldTagElArray = node.getElementsByTagName('b');78 assertNumBoldTags(boldTagElArray, 1);79}80function testShouldMatchOnlyOncePerDefaultWithComplexHtmlStrings() {81 // '<div><div>test1</div><div>test2</div></div>'82 var row = rendRows[5];83 var token = 'te';84 enableHtmlRendering(renderer);85 var node = renderer.renderRowHtml(row, token);86 var boldTagElArray = node.getElementsByTagName('b');87 // It should match and render highlighting for the first 'test1' and88 // stop here. This is the default behavior of the renderer.89 assertNumBoldTags(boldTagElArray, 1);90}91function testShouldMatchMultipleTimesWithComplexHtmlStrings() {92 renderer.setHighlightAllTokens(true);93 // '<div><div>test1</div><div>test2</div></div>'94 var row = rendRows[5];95 var token = 'te';96 enableHtmlRendering(renderer);97 var node = renderer.renderRowHtml(row, token);98 var boldTagElArray = node.getElementsByTagName('b');99 // It should match and render highlighting for both 'test1' and 'test2'.100 assertNumBoldTags(boldTagElArray, 2);101 // Try again with a more complex HTML string.102 // '<div>random test string<div>test1</div><div><div>test2</div><div>test3</div></div></div>'103 row = rendRows[6];104 node = renderer.renderRowHtml(row, token);105 boldTagElArray = node.getElementsByTagName('b');106 // It should match 'test', 'test1', 'test2' and 'test3' wherever they are in the107 // DOM tree.108 assertNumBoldTags(boldTagElArray, 4);109}110function testBasicStringTokenHighlightingUsingUniversalMatching() {111 var row = rendRows[0]; // 'Amanda Annie Anderson'112 renderer.setMatchWordBoundary(false);113 // Should highlight first match only.114 var token = 'A';115 var node = renderer.renderRowHtml(row, token);116 var boldTagElArray = node.getElementsByTagName('b');117 assertNumBoldTags(boldTagElArray, 1);118 assertPreviousNodeText(boldTagElArray[0], '');119 assertHighlightedText(boldTagElArray[0], 'A');120 assertLastNodeText(node, 'manda Annie Anderson');121 // Match should be case insensitive, and should match tokens in the122 // middle of words if useWordMatching is turned off ("an" in Amanda).123 var token = 'an';124 var node = renderer.renderRowHtml(row, token);125 var boldTagElArray = node.getElementsByTagName('b');126 assertNumBoldTags(boldTagElArray, 1);127 assertPreviousNodeText(boldTagElArray[0], 'Am');128 assertHighlightedText(boldTagElArray[0], 'an');129 assertLastNodeText(node, 'da Annie Anderson');130 // Should only match on non-empty strings.131 token = '';132 node = renderer.renderRowHtml(row, token);133 boldTagElArray = node.getElementsByTagName('b');134 assertNumBoldTags(boldTagElArray, 0);135 assertLastNodeText(node, 'Amanda Annie Anderson');136 // Should not match leading whitespace.137 token = ' an';138 node = renderer.renderRowHtml(row, token);139 boldTagElArray = node.getElementsByTagName('b');140 assertNumBoldTags(boldTagElArray, 0);141 assertLastNodeText(node, 'Amanda Annie Anderson');142}143function testBasicStringTokenHighlighting() {144 var row = rendRows[0]; // 'Amanda Annie Anderson'145 // Should highlight first match only.146 var token = 'A';147 var node = renderer.renderRowHtml(row, token);148 var boldTagElArray = node.getElementsByTagName('b');149 assertNumBoldTags(boldTagElArray, 1);150 assertPreviousNodeText(boldTagElArray[0], '');151 assertHighlightedText(boldTagElArray[0], 'A');152 assertLastNodeText(node, 'manda Annie Anderson');153 // Should only match on non-empty strings.154 token = '';155 node = renderer.renderRowHtml(row, token);156 boldTagElArray = node.getElementsByTagName('b');157 assertNumBoldTags(boldTagElArray, 0);158 assertLastNodeText(node, 'Amanda Annie Anderson');159 // Match should be case insensitive, and should not match tokens in the160 // middle of words ("an" in Amanda).161 token = 'an';162 node = renderer.renderRowHtml(row, token);163 boldTagElArray = node.getElementsByTagName('b');164 assertNumBoldTags(boldTagElArray, 1);165 assertPreviousNodeText(boldTagElArray[0], 'Amanda ');166 assertHighlightedText(boldTagElArray[0], 'An');167 assertLastNodeText(node, 'nie Anderson');168 // Should not match whitespace.169 token = ' ';170 node = renderer.renderRowHtml(row, token);171 boldTagElArray = node.getElementsByTagName('b');172 assertNumBoldTags(boldTagElArray, 0);173 assertLastNodeText(node, 'Amanda Annie Anderson');174 // Should not match leading whitespace since all matches are at the start of175 // word boundaries.176 token = ' an';177 node = renderer.renderRowHtml(row, token);178 boldTagElArray = node.getElementsByTagName('b');179 assertNumBoldTags(boldTagElArray, 0);180 assertLastNodeText(node, 'Amanda Annie Anderson');181 // Should match trailing whitespace.182 token = 'annie ';183 node = renderer.renderRowHtml(row, token);184 boldTagElArray = node.getElementsByTagName('b');185 assertNumBoldTags(boldTagElArray, 1);186 assertPreviousNodeText(boldTagElArray[0], 'Amanda ');187 assertHighlightedText(boldTagElArray[0], 'Annie ');188 assertLastNodeText(node, 'Anderson');189 // Should match across whitespace.190 row = rendRows[2]; // 'Louis D Armstrong'191 token = 'd a';192 node = renderer.renderRowHtml(row, token);193 boldTagElArray = node.getElementsByTagName('b');194 assertNumBoldTags(boldTagElArray, 1);195 assertPreviousNodeText(boldTagElArray[0], 'Louis ');196 assertHighlightedText(boldTagElArray[0], 'D A');197 assertLastNodeText(node, 'rmstrong');198 // Should match the last token.199 token = 'aRmStRoNg';200 node = renderer.renderRowHtml(row, token);201 boldTagElArray = node.getElementsByTagName('b');202 assertNumBoldTags(boldTagElArray, 1);203 assertPreviousNodeText(boldTagElArray[0], 'Louis D ');204 assertHighlightedText(boldTagElArray[0], 'Armstrong');205 assertLastNodeText(node, '');206}207// The name of this function is fortuitous, in that it gets tested208// last on FF. The lazy regexp on FF is particularly slow, and causes209// the test to take a long time, and sometimes time out when run on forge210// because it triggers the test runner to go back to the event loop...211function testPathologicalInput() {212 // Should not hang on bizarrely long strings213 var row = rendRows[3]; // pathological row214 var token = 'foo';215 var node = renderer.renderRowHtml(row, token);216 var boldTagElArray = node.getElementsByTagName('b');217 assertNumBoldTags(boldTagElArray, 1);218 assertHighlightedText(boldTagElArray[0], 'Foo');219 assert(goog.string.startsWith(220 boldTagElArray[0].nextSibling.nodeValue, ' Bar...'));221}222function testBasicArrayTokenHighlighting() {223 var row = rendRows[1]; // 'Frankie Manning'224 // Only the first match in the array should be highlighted.225 var token = ['f', 'm'];226 var node = renderer.renderRowHtml(row, token);227 var boldTagElArray = node.getElementsByTagName('b');228 assertNumBoldTags(boldTagElArray, 1);229 assertPreviousNodeText(boldTagElArray[0], '');230 assertHighlightedText(boldTagElArray[0], 'F');231 assertLastNodeText(node, 'rankie Manning');232 // Only the first match in the array should be highlighted.233 token = ['m', 'f'];234 node = renderer.renderRowHtml(row, token);235 boldTagElArray = node.getElementsByTagName('b');236 assertNumBoldTags(boldTagElArray, 1);237 assertPreviousNodeText(boldTagElArray[0], 'Frankie ');238 assertHighlightedText(boldTagElArray[0], 'M');239 assertLastNodeText(node, 'anning');240 // Skip tokens that do not match.241 token = ['asdf', 'f'];242 node = renderer.renderRowHtml(row, token);243 boldTagElArray = node.getElementsByTagName('b');244 assertNumBoldTags(boldTagElArray, 1);245 assertPreviousNodeText(boldTagElArray[0], '');246 assertHighlightedText(boldTagElArray[0], 'F');247 assertLastNodeText(node, 'rankie Manning');248 // Highlight nothing if no tokens match.249 token = ['Foo', 'bar', 'baz'];250 node = renderer.renderRowHtml(row, token);251 boldTagElArray = node.getElementsByTagName('b');252 assertNumBoldTags(boldTagElArray, 0);253 assertLastNodeText(node, 'Frankie Manning');254 // Empty array should not match.255 token = [];256 node = renderer.renderRowHtml(row, token);257 boldTagElArray = node.getElementsByTagName('b');258 assertNumBoldTags(boldTagElArray, 0);259 assertLastNodeText(node, 'Frankie Manning');260 // Empty string in array should not match.261 token = [''];262 node = renderer.renderRowHtml(row, token);263 boldTagElArray = node.getElementsByTagName('b');264 assertNumBoldTags(boldTagElArray, 0);265 assertLastNodeText(node, 'Frankie Manning');266 // Whitespace in array should not match.267 token = [' '];268 node = renderer.renderRowHtml(row, token);269 boldTagElArray = node.getElementsByTagName('b');270 assertNumBoldTags(boldTagElArray, 0);271 assertLastNodeText(node, 'Frankie Manning');272 // Whitespace entries in array should not match.273 token = [' ', 'man'];274 node = renderer.renderRowHtml(row, token);275 boldTagElArray = node.getElementsByTagName('b');276 assertNumBoldTags(boldTagElArray, 1);277 assertPreviousNodeText(boldTagElArray[0], 'Frankie ');278 assertHighlightedText(boldTagElArray[0], 'Man');279 assertLastNodeText(node, 'ning');280 // Whitespace in array entry should match as a whole token.281 row = rendRows[2]; // 'Louis D Armstrong'282 token = ['d arm', 'lou'];283 node = renderer.renderRowHtml(row, token);284 boldTagElArray = node.getElementsByTagName('b');285 assertNumBoldTags(boldTagElArray, 1);286 assertPreviousNodeText(boldTagElArray[0], 'Louis ');287 assertHighlightedText(boldTagElArray[0], 'D Arm');288 assertLastNodeText(node, 'strong');289}290function testHighlightAllTokensSingleTokenHighlighting() {291 renderer.setHighlightAllTokens(true);292 var row = rendRows[0]; // 'Amanda Annie Anderson'293 // All matches at the start of the word should be highlighted when294 // highlightAllTokens is set.295 var token = 'a';296 var node = renderer.renderRowHtml(row, token);297 var boldTagElArray = node.getElementsByTagName('b');298 assertNumBoldTags(boldTagElArray, 3);299 assertPreviousNodeText(boldTagElArray[0], '');300 assertHighlightedText(boldTagElArray[0], 'A');301 assertPreviousNodeText(boldTagElArray[1], 'manda ');302 assertHighlightedText(boldTagElArray[1], 'A');303 assertPreviousNodeText(boldTagElArray[2], 'nnie ');304 assertHighlightedText(boldTagElArray[2], 'A');305 assertLastNodeText(node, 'nderson');306 // Should not match on empty string.307 token = '';308 node = renderer.renderRowHtml(row, token);309 boldTagElArray = node.getElementsByTagName('b');310 assertNumBoldTags(boldTagElArray, 0);311 assertLastNodeText(node, 'Amanda Annie Anderson');312 // Match should be case insensitive.313 token = 'AN';314 node = renderer.renderRowHtml(row, token);315 boldTagElArray = node.getElementsByTagName('b');316 assertNumBoldTags(boldTagElArray, 2);317 assertPreviousNodeText(boldTagElArray[0], 'Amanda ');318 assertHighlightedText(boldTagElArray[0], 'An');319 assertPreviousNodeText(boldTagElArray[1], 'nie ');320 assertHighlightedText(boldTagElArray[1], 'An');321 assertLastNodeText(node, 'derson');322 // Should not match on whitespace.323 token = ' ';324 node = renderer.renderRowHtml(row, token);325 boldTagElArray = node.getElementsByTagName('b');326 assertNumBoldTags(boldTagElArray, 0);327 assertLastNodeText(node, 'Amanda Annie Anderson');328 // When highlighting all tokens, should match despite leading whitespace.329 token = ' am';330 node = renderer.renderRowHtml(row, token);331 boldTagElArray = node.getElementsByTagName('b');332 assertNumBoldTags(boldTagElArray, 1);333 assertPreviousNodeText(boldTagElArray[0], '');334 assertHighlightedText(boldTagElArray[0], 'Am');335 assertLastNodeText(node, 'anda Annie Anderson');336 // Should match with trailing whitepsace.337 token = 'ann ';338 node = renderer.renderRowHtml(row, token);339 boldTagElArray = node.getElementsByTagName('b');340 assertNumBoldTags(boldTagElArray, 1);341 assertPreviousNodeText(boldTagElArray[0], 'Amanda ');342 assertHighlightedText(boldTagElArray[0], 'Ann');343 assertLastNodeText(node, 'ie Anderson');344}345function testHighlightAllTokensMultipleStringTokenHighlighting() {346 renderer.setHighlightAllTokens(true);347 var row = rendRows[1]; // 'Frankie Manning'348 // Each individual space-separated token should match.349 var token = 'm F';350 var node = renderer.renderRowHtml(row, token);351 var boldTagElArray = node.getElementsByTagName('b');352 assertNumBoldTags(boldTagElArray, 2);353 assertPreviousNodeText(boldTagElArray[0], '');354 assertHighlightedText(boldTagElArray[0], 'F');355 assertPreviousNodeText(boldTagElArray[1], 'rankie ');356 assertHighlightedText(boldTagElArray[1], 'M');357 assertLastNodeText(node, 'anning');358}359function testHighlightAllTokensArrayTokenHighlighting() {360 renderer.setHighlightAllTokens(true);361 var row = rendRows[0]; // 'Amanda Annie Anderson'362 // All tokens in the array should match.363 var token = ['AM', 'AN'];364 var node = renderer.renderRowHtml(row, token);365 var boldTagElArray = node.getElementsByTagName('b');366 assertNumBoldTags(boldTagElArray, 3);367 assertPreviousNodeText(boldTagElArray[0], '');368 assertHighlightedText(boldTagElArray[0], 'Am');369 assertPreviousNodeText(boldTagElArray[1], 'anda ');370 assertHighlightedText(boldTagElArray[1], 'An');371 assertPreviousNodeText(boldTagElArray[2], 'nie ');372 assertHighlightedText(boldTagElArray[2], 'An');373 assertLastNodeText(node, 'derson');374 // Empty array should not match.375 token = [];376 node = renderer.renderRowHtml(row, token);377 boldTagElArray = node.getElementsByTagName('b');378 assertNumBoldTags(boldTagElArray, 0);379 assertLastNodeText(node, 'Amanda Annie Anderson');380 // Empty string in array should not match.381 token = [''];382 node = renderer.renderRowHtml(row, token);383 boldTagElArray = node.getElementsByTagName('b');384 assertNumBoldTags(boldTagElArray, 0);385 assertLastNodeText(node, 'Amanda Annie Anderson');386 // Whitespace in array should not match.387 token = [' '];388 node = renderer.renderRowHtml(row, token);389 boldTagElArray = node.getElementsByTagName('b');390 assertNumBoldTags(boldTagElArray, 0);391 assertLastNodeText(node, 'Amanda Annie Anderson');392 // Empty string entries in array should not match.393 token = ['', 'Ann'];394 node = renderer.renderRowHtml(row, token);395 boldTagElArray = node.getElementsByTagName('b');396 assertNumBoldTags(boldTagElArray, 1);397 assertPreviousNodeText(boldTagElArray[0], 'Amanda ');398 assertHighlightedText(boldTagElArray[0], 'Ann');399 assertLastNodeText(node, 'ie Anderson');400 // Whitespace entries in array should not match.401 token = [' ', 'And'];402 node = renderer.renderRowHtml(row, token);403 boldTagElArray = node.getElementsByTagName('b');404 assertNumBoldTags(boldTagElArray, 1);405 assertPreviousNodeText(boldTagElArray[0], 'Amanda Annie ');406 assertHighlightedText(boldTagElArray[0], 'And');407 assertLastNodeText(node, 'erson');408 // Whitespace in array entry should match as a whole token.409 token = ['annie a', 'Am'];410 node = renderer.renderRowHtml(row, token);411 var boldTagElArray = node.getElementsByTagName('b');412 assertNumBoldTags(boldTagElArray, 2);413 assertPreviousNodeText(boldTagElArray[0], '');414 assertHighlightedText(boldTagElArray[0], 'Am');415 assertPreviousNodeText(boldTagElArray[1], 'anda ');416 assertHighlightedText(boldTagElArray[1], 'Annie A');417 assertLastNodeText(node, 'nderson');418}419function testMenuFadeDuration() {420 var hideCalled = false;421 var hideAnimCalled = false;422 var showCalled = false;423 var showAnimCalled = false;424 propertyReplacer.set(goog.style, 'setElementShown', function(el, state) {425 if (state) {426 showCalled = true;427 } else {428 hideCalled = true;429 }430 });431 propertyReplacer.set(goog.fx.dom.FadeInAndShow.prototype, 'play',432 function() {433 showAnimCalled = true;434 });435 propertyReplacer.set(goog.fx.dom.FadeOutAndHide.prototype, 'play',436 function() {437 hideAnimCalled = true;438 });439 // Default behavior does show/hide but not animations.440 renderer.show();441 assertTrue(showCalled);442 assertFalse(showAnimCalled);443 renderer.dismiss();444 assertTrue(hideCalled);445 assertFalse(hideAnimCalled);446 // But animations can be turned on.447 showCalled = false;448 hideCalled = false;449 renderer.setMenuFadeDuration(100);450 renderer.show();451 assertFalse(showCalled);452 assertTrue(showAnimCalled);453 renderer.dismiss();454 assertFalse(hideCalled);455 assertTrue(hideAnimCalled);456}457function testAriaTags() {458 renderer.maybeCreateElement_();459 assertNotNull(target);460 assertEvaluatesToFalse('The role should be empty.',461 goog.a11y.aria.getRole(target));462 assertEquals('',463 goog.a11y.aria.getState(target,464 goog.a11y.aria.State.AUTOCOMPLETE));465 assertEquals('',466 goog.a11y.aria.getState(target,467 goog.a11y.aria.State.HASPOPUP));468 renderer.show();469 assertEquals(goog.a11y.aria.Role.COMBOBOX, goog.a11y.aria.getRole(470 target));471 assertEquals('list',472 goog.a11y.aria.getState(target,473 goog.a11y.aria.State.AUTOCOMPLETE));474 assertEquals('true',475 goog.a11y.aria.getState(target,476 goog.a11y.aria.State.HASPOPUP));477 renderer.dismiss();478 assertEquals(goog.a11y.aria.Role.COMBOBOX, goog.a11y.aria.getRole(479 target));480 assertEquals('list',481 goog.a11y.aria.getState(target,482 goog.a11y.aria.State.AUTOCOMPLETE));483 assertEquals('false',484 goog.a11y.aria.getState(target,485 goog.a11y.aria.State.HASPOPUP));486}487function testHiliteRowWithDefaultRenderer() {488 renderer.renderRows(rendRows, '');489 renderer.hiliteRow(2);490 assertEquals(2, renderer.hilitedRow_);491 assertTrue(goog.dom.classlist.contains(492 renderer.rowDivs_[2], renderer.activeClassName));493}494function testHiliteRowWithCustomRenderer() {495 goog.dispose(renderer);496 // Use a custom renderer that doesn't put the result divs as direct children497 // of this.element_.498 var customRenderer = {499 render: function(renderer, element, rows, token) {500 // Put all of the results into a results holder div that is a child of501 // this.element_.502 var resultsHolder = goog.dom.createDom('div');503 goog.dom.appendChild(element, resultsHolder);504 for (var i = 0, row; row = rows[i]; ++i) {505 var node = renderer.renderRowHtml(row, token);506 goog.dom.appendChild(resultsHolder, node);507 }508 }509 };510 renderer = new goog.ui.ac.Renderer(null, customRenderer);511 // Make sure we can still highlight the row at position 2 even though512 // this.element_.childNodes contains only a single child.513 renderer.renderRows(rendRows, '');514 renderer.hiliteRow(2);515 assertEquals(2, renderer.hilitedRow_);516 assertTrue(goog.dom.classlist.contains(517 renderer.rowDivs_[2], renderer.activeClassName));518}519function testReposition() {520 renderer.renderRows(rendRows, '', target);521 var el = renderer.getElement();522 el.style.position = 'absolute';523 el.style.width = '100px';524 renderer.setAutoPosition(true);525 renderer.redraw();526 var rendererOffset = goog.style.getPageOffset(renderer.getElement());527 var rendererSize = goog.style.getSize(renderer.getElement());528 var targetOffset = goog.style.getPageOffset(target);529 var targetSize = goog.style.getSize(target);530 assertEquals(0 + targetOffset.x, rendererOffset.x);531 assertRoughlyEquals(532 targetOffset.y + targetSize.height, rendererOffset.y, 1);533}534function testRepositionWithRightAlign() {535 renderer.renderRows(rendRows, '', target);536 var el = renderer.getElement();537 el.style.position = 'absolute';538 el.style.width = '150px';539 renderer.setAutoPosition(true);540 renderer.setRightAlign(true);541 renderer.redraw();542 var rendererOffset = goog.style.getPageOffset(renderer.getElement());543 var rendererSize = goog.style.getSize(renderer.getElement());544 var targetOffset = goog.style.getPageOffset(target);545 var targetSize = goog.style.getSize(target);546 assertRoughlyEquals(547 targetOffset.x + targetSize.width,548 rendererOffset.x + rendererSize.width,549 1);550 assertRoughlyEquals(551 targetOffset.y + targetSize.height, rendererOffset.y, 1);552}553function testRepositionResizeHeight() {554 renderer = new goog.ui.ac.Renderer(viewport);555 // Render the first 4 rows from test set.556 renderer.renderRows(rendRows.slice(0, 4), '', viewportTarget);557 renderer.setAutoPosition(true);558 renderer.setShowScrollbarsIfTooLarge(true);559 // Stick a huge row in the dropdown element, to make sure it won't fit in the viewport.560 var hugeRow = goog.dom.createDom('div', {style: 'height:1000px'});561 goog.dom.appendChild(renderer.getElement(), hugeRow);562 renderer.reposition();563 var rendererOffset = goog.style.getPageOffset(renderer.getElement());564 var rendererSize = goog.style.getSize(renderer.getElement());565 var viewportOffset = goog.style.getPageOffset(viewport);566 var viewportSize = goog.style.getSize(viewport);567 assertRoughlyEquals(568 viewportOffset.y + viewportSize.height,569 rendererSize.height + rendererOffset.y,570 1);571 // Remove the huge row, and make sure that the dropdown element gets shrunk.572 renderer.getElement().removeChild(hugeRow);573 renderer.reposition();574 rendererOffset = goog.style.getPageOffset(renderer.getElement());575 rendererSize = goog.style.getSize(renderer.getElement());576 viewportOffset = goog.style.getPageOffset(viewport);577 viewportSize = goog.style.getSize(viewport);578 assertTrue((rendererSize.height + rendererOffset.y) < (viewportOffset.y + viewportSize.height));579}580function testHiliteEvent() {581 renderer.renderRows(rendRows, '');582 var hiliteEventFired = false;583 goog.events.listenOnce(renderer,584 goog.ui.ac.AutoComplete.EventType.ROW_HILITE,585 function(e) {586 hiliteEventFired = true;587 assertEquals(e.row, rendRows[1].data);588 });589 renderer.hiliteRow(1);590 assertTrue(hiliteEventFired);591 hiliteEventFired = false;592 goog.events.listenOnce(renderer,593 goog.ui.ac.AutoComplete.EventType.ROW_HILITE,594 function(e) {595 hiliteEventFired = true;596 assertNull(e.row);597 });598 renderer.hiliteRow(rendRows.length); // i.e. out of bounds.599 assertTrue(hiliteEventFired);600}601// ------- Helper functions -------602// The default rowRenderer will escape any HTML in the row content.603// Activating HTML rendering will allow HTML strings to be rendered to DOM604// instead of being escaped.605function enableHtmlRendering(renderer) {606 renderer.customRenderer_ = {607 renderRow: function(row, token, node) {608 node.innerHTML = row.data.toString();609 }610 };611}612function assertNumBoldTags(boldTagElArray, expectedNum) {613 assertEquals('Incorrect number of bold tags', expectedNum,614 boldTagElArray.length);615}616function assertPreviousNodeText(boldTag, expectedText) {617 var prevNode = boldTag.previousSibling;618 assertEquals('Expected text before the token does not match', expectedText,619 prevNode.nodeValue);620}621function assertHighlightedText(boldTag, expectedHighlightedText) {622 assertEquals('Incorrect text bolded', expectedHighlightedText,623 boldTag.innerHTML);624}625function assertLastNodeText(node, expectedText) {626 var lastNode = node.lastChild;627 assertEquals('Incorrect text in the last node', expectedText,628 lastNode.nodeValue);...
resources.py
Source:resources.py
1# coding: utf-82import random3# ------------------------------------------------------ CONSTANTS ----------------------------------------------------#4BLANK = ' '5stop = 06boss_levels = [10]7RESET_SETTINGS = '\033[0m'8colors = [9 '\033[91m', '\033[93m', '\033[32m', # [red, yellow, green10 '\033[34m', '\033[37m', '\033[35m', # blue , white, purple11 '\033[96m', '\033[33m', '\033[92m', # light bl, or, light cyan12 '\033[05m', '\033[95m', '\033[5m',13 '\033[36m', '\033[40m', '\033[94m',14 ]15symbols = ['ðµ', 'ð', 'â«', 'ð¶', 'â©', 'â¬', 'â¯', 'â', 'â®', 'ð¢', 'ð', 'ðª', 'ð«']16italic = '\33[3m'17bold = '\033[1m'18LIFT = colors[0] + bold + 'ð'19UNDERLINE = '\033[4m'20DISABLE = '\033[02m'21REVERSE = '\033[07m'22# ------------------------------------------------------ PRIZES CLASS--------------------------------------------------#23SURPRISE = colors[random.randint(0, 8)] + bold + ' ð '24EXTEND = colors[8] + bold + '𡸠𡺠'25SHRINK = colors[0] + bold + '𡺠𡸠'26NEW_BALL = colors[8] + bold + 'âº' + RESET_SETTINGS + colors[6] + 'ðµ'27GLUE = colors[7] + bold + 'ðð '28PROTECTION = [colors[7] + 'ð§ ', colors[7] + bold + 'ð§ ']29FASTER = colors[0] + bold + 'ð '30SLOWER = colors[8] + bold + 'ð '31DEATH_1 = colors[0] + bold + 'ð '32DEATH_2 = colors[0] + bold + 'ð '33EXTRA_LIFE = colors[4] + 'ð¹ '34BARLINE = bold + colors[2] + 'ðð'35AUTOPILOT = colors[9] + bold + 'ð '36FIRE = colors[6] + bold + ' ð '37# ------------------------------------------------------ MONSTER CLASS-------------------------------------------------#38MONSTER_1 = colors[8] + bold + 'ð '39MONSTER_2 = colors[6] + bold + 'ð¤ '40HINDRANCE_1 = RESET_SETTINGS + colors[11] + bold + 'ð© '41HINDRANCE_2 = colors[3] + bold + 'ðª '42EXPLOSION = [43 colors[1] + bold + 'ð¥ ',44 colors[0] + bold + 'ð¥ ',45 colors[0] + bold + 'ð ',46 colors[0] + bold + 'ð¥ '47 ]48monsters = [MONSTER_1, MONSTER_2, HINDRANCE_1, HINDRANCE_2]49BOMBS = [50 colors[0] + bold + 'ð ',51 colors[0] + bold + 'ð ',52 colors[0] + bold + 'ð£ ',53 colors[6] + bold + 'ð² ',54 colors[1] + 'ð¥ ',55 colors[0] + bold + ' ð ',56 ]57# ------------------------------------------------------ BALL CLASS----------------------------------------------------#58BALL = colors[1] + 'âº'59# ------------------------------------------------------ FONTS --------------------------------------------------------#60monsters_font = colors[0] + italic + ' Monsters'61hindrances_font = colors[0] + italic + ' Hindrances'62surprise_font = RESET_SETTINGS + colors[10] + italic + ' Musical Box'63extend_font = RESET_SETTINGS + colors[10] + italic + ' Octave++ '64shrink_font = RESET_SETTINGS + colors[10] + italic + ' Octave--'65new_ball_font = RESET_SETTINGS + colors[10] + italic + ' Polyphony'66glue_font = RESET_SETTINGS + colors[10] + italic + ' Fermata'67extra_life_font = RESET_SETTINGS + colors[10] + italic + ' Grand Piano'68faster_font = RESET_SETTINGS + colors[10] + italic + ' Crescendo'69slower_font = RESET_SETTINGS + colors[10] + italic + ' Diminuendo'70protection_font = RESET_SETTINGS + colors[10] + italic + ' Acoustic'71barline_font = RESET_SETTINGS + colors[10] + italic + ' Barlines'72autopilot_font = RESET_SETTINGS + colors[10] + italic + ' Kissin mode'73fire_font = RESET_SETTINGS + colors[10] + italic + ' Trills'74fire_instr = colors[0] + bold + 'Space' + RESET_SETTINGS + colors[8] + italic + ' Start&Fire'75pause_font = colors[0] + bold + 'P,p' + RESET_SETTINGS + colors[8] + italic + ' Pause'76quit_font = colors[0] + bold + 'Q' + RESET_SETTINGS + colors[8] + italic + ' Quit'77exit_font = colors[0] + bold + 'Esc' + RESET_SETTINGS + colors[8] + italic + ' Restart'78level_font = RESET_SETTINGS + italic + bold + colors[1] + ' Level #'79pause_message = colors[13] + bold + 'PAUSE'80BASS_CLEF = colors[2] + UNDERLINE + 'ð¢'81MUSICAL_STAFF = colors[2] + UNDERLINE + 'ð¼'82REPRISE_LEFT = colors[2] + 'ð '83REPRISE_RIGHT = colors[2] + 'ð '84DASH = colors[8] + bold + '-'85# ------------------------------------------------------ PADDLE CLASS -------------------------------------------------#86TRILL = colors[6] + bold + 'ð'87LIVES = colors[0] + bold + 'ð '88PIANO = 'ð¹'89PIANO_FIRE = bold + 'ð' + RESET_SETTINGS90glue_color = colors[1] + 'ð®' + RESET_SETTINGS91paddle_font = colors[4]92AUTO_ = 'ð'93barline = colors[2] + 'ð'94# ------------------------------------------------------ BOSS CLASS ---------------------------------------------------#95BOSS = 096BOSS_ = REVERSE97BOSS_FIRE = colors[6] + bold + 'ð² '98BOSS_LIVES = colors[0] + bold + 'ðµ'99# ------------------------------------------------------ SPECIAL MESSAGES----------------------------------------------#100game_over_font = colors[0] + bold + 'ðµ'101GAME_OVER = colors[1] + bold + 'GAME OVER'102COMPLETE_VICTORY = colors[0] + bold + 'ð You have completed all levels!!! ð '103ENTER_TO_MENU = colors[0] + bold + 'Press any key to exit'104NEW_LEVEL = colors[0] + bold + 'ð You have won. Prepare for the next level! ð '105# ----------------------------------------------------------Bricks------------------------------------------------------#106b0 = ['', 0]107b1 = [colors[0] + 'ðµ'*5, 1]108b1_0 = [colors[10] + 'ðµ'*5, 1]109b2 = [colors[10] + 'ð'*5, colors[10] + bold + 'ð'*5, 2]110b2_0 = [colors[1] + 'ð'*5, colors[1] + bold + 'ð'*5, 2]111b2_01 = [colors[1] + bold + 'ð'*5, 1]112b3 = [colors[8] + bold + 'ð¶'*5, 1]113b4 = [colors[7] + 'ðµ'*5, colors[0] + 'ðµ'*5, 2]114b5 = [colors[1] + bold + 'â©'*5, 1]115b6 = [colors[7] + 'â¬'*5, colors[1] + bold + 'â¬'*5, 2]116b7 = [colors[12] + 'âª'*5, colors[12] + bold + 'âª'*5, 2]117b7_ = [colors[12] + bold + 'âª'*5, 1]118b8 = [colors[3] + bold + 'ð'*5, colors[3] + 'ð'*5, 2]119b9 = [colors[2] + 'ðµ'*5, colors[2] + bold + 'ðµ'*5, 2]120b10 = [colors[9]+bold + 'â©'*5, 1]121b11 = [colors[7] + 'ð¶'*5, colors[7] + bold + 'ð¶'*5, 2]122b12 = [colors[10] + bold + 'â¬'*5, colors[5] + 'â¬'*5, 2]123b13 = [colors[6] + 'ð¢'*5, colors[6] + bold + 'ð®' * 5, 2]124b14 = ['ð'*5, bold + 'ð'*5, 2]125b15 = ['ð'*5, italic + 'ð'*5, bold + 'ð' * 5, 3]126b16 = [colors[7] + 'ð'*5, colors[7] + italic + 'ð'*5, colors[7] + bold + 'ð'*5, 3]127# indestructible128b100 = [DISABLE + bold + 'ð'*5, -1]129b100_0 = [colors[12] + bold + 'ð'*5, -1]130b101 = [colors[4] + 'ð¯'*5, -1]131b102 = [colors[4] + 'ð°'*5, -1]132# blinking133b110 = [colors[5] + 'ð'*5, 'B', 1] # blinking bricks134b111 = [colors[12] + 'â'*5, 'B', 1] # blinking bricks135b112 = [colors[4] + 'â'*5, 'B', 1] # blinking bricks136b113 = [colors[1] + 'â'*5, 'B', 1] # blinking bricks137# ------------------------------------------------------MENU--------------------------------------------------#138CLEF = colors[0] + bold + 'ð'139NEW_GAME = colors[8] + bold + italic + ' New Game'140CHOOSE_LEVEL = colors[8] + bold + italic + 'Levels'141HELP = colors[8] + bold + italic + 'Help'142QUIT = colors[8] + bold + italic + 'Quit'143RETURN_MENT = colors[8] + bold + italic + 'Return to menu'144level_font_menu = colors[8] + bold + italic + 'Level'145red_note = colors[0] + bold + 'ðµ'146slim_note = colors[12] + 'âª'147yellow_note = colors[1] + bold + 'ðµ'148green_note = colors[8] + bold + 'ðµ'149bottom_note = colors[14] + 'ðµ'150BREND = colors[6] + bold + italic + 'PIANOID'151PRIZES_HELP = colors[0] + italic + 'P r i z e s t y p e s : '...
colorful.py
Source:colorful.py
1# -*- coding: utf-8 -*-2"""3 pygments.styles.colorful4 ~~~~~~~~~~~~~~~~~~~~~~~~5 A colorful style, inspired by CodeRay.6 :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.7 :license: BSD, see LICENSE for details.8"""9from pygments.style import Style10from pygments.token import Keyword, Name, Comment, String, Error, \11 Number, Operator, Generic, Whitespace12class ColorfulStyle(Style):13 """14 A colorful style, inspired by CodeRay.15 """16 default_style = ""17 styles = {18 Whitespace: "#bbbbbb",19 Comment: "#888",20 Comment.Preproc: "#579",21 Comment.Special: "bold #cc0000",22 Keyword: "bold #080",23 Keyword.Pseudo: "#038",24 Keyword.Type: "#339",25 Operator: "#333",26 Operator.Word: "bold #000",27 Name.Builtin: "#007020",28 Name.Function: "bold #06B",29 Name.Class: "bold #B06",30 Name.Namespace: "bold #0e84b5",31 Name.Exception: "bold #F00",32 Name.Variable: "#963",33 Name.Variable.Instance: "#33B",34 Name.Variable.Class: "#369",35 Name.Variable.Global: "bold #d70",36 Name.Constant: "bold #036",37 Name.Label: "bold #970",38 Name.Entity: "bold #800",39 Name.Attribute: "#00C",40 Name.Tag: "#070",41 Name.Decorator: "bold #555",42 String: "bg:#fff0f0",43 String.Char: "#04D bg:",44 String.Doc: "#D42 bg:",45 String.Interpol: "bg:#eee",46 String.Escape: "bold #666",47 String.Regex: "bg:#fff0ff #000",48 String.Symbol: "#A60 bg:",49 String.Other: "#D20",50 Number: "bold #60E",51 Number.Integer: "bold #00D",52 Number.Float: "bold #60E",53 Number.Hex: "bold #058",54 Number.Oct: "bold #40E",55 Generic.Heading: "bold #000080",56 Generic.Subheading: "bold #800080",57 Generic.Deleted: "#A00000",58 Generic.Inserted: "#00A000",59 Generic.Error: "#FF0000",60 Generic.Emph: "italic",61 Generic.Strong: "bold",62 Generic.Prompt: "bold #c65d09",63 Generic.Output: "#888",64 Generic.Traceback: "#04D",65 Error: "#F00 bg:#FAA"...
Using AI Code Generation
1import { bold } from 'storybook-test-runner'2console.log(bold('Hello World!'))3import { italic } from 'storybook-test-runner'4console.log(italic('Hello World!'))5import { underline } from 'storybook-test-runner'6console.log(underline('Hello World!'))7import { strike } from 'storybook-test-runner'8console.log(strike('Hello World!'))9import { inverse } from 'storybook-test-runner'10console.log(inverse('Hello World!'))11import { black } from 'storybook-test-runner'12console.log(black('Hello World!'))13import { red } from 'storybook-test-runner'14console.log(red('Hello World!'))15import { green } from 'storybook-test-runner'16console.log(green('Hello World!'))17import { yellow } from 'storybook-test-runner'18console.log(yellow('Hello World!'))19import { blue } from 'storybook-test-runner'20console.log(blue('Hello World!'))21import { magenta } from 'storybook-test-runner'22console.log(magenta('Hello World!'))23import { cyan } from 'storybook-test-runner'24console.log(cyan('Hello World!'))25import { white } from 'storybook-test-runner'26console.log(white('Hello World!'))27import { gray } from 'storybook-test-runner'28console.log(gray('Hello World!'))29import { bgBlack } from 'storybook-test-runner'30console.log(bgBlack('Hello World!'))31import { bgRed } from 'storybook-test-runner'32console.log(bgRed('Hello World!'))
Using AI Code Generation
1const { bold } = require('storybook-test-runner');2console.log(bold('Hello World'));3const { italic } = require('storybook-test-runner');4console.log(italic('Hello World'));5const { underline } = require('storybook-test-runner');6console.log(underline('Hello World'));7const { strikethrough } = require('storybook-test-runner');8console.log(strikethrough('Hello World'));9const { rainbow } = require('storybook-test-runner');10console.log(rainbow('Hello World'));11const { random } = require('storybook-test-runner');12console.log(random('Hello World'));13const { zebra } = require('storybook-test-runner');14console.log(zebra('Hello World'));15const { america } = require('storybook-test-runner');16console.log(america('Hello World'));17const { trap } = require('storybook-test-runner');18console.log(trap('Hello World'));19const { random } = require('storybook-test-runner');20console.log(random('Hello World'));21const { zebra } = require('storybook-test-runner');22console.log(zebra('Hello World'));23const { america } = require('storybook-test-runner');24console.log(america('Hello World'));25const { trap } = require('storybook-test-runner');26console.log(trap('Hello World'));27const { random
Using AI Code Generation
1const { bold } = require('storybook-test-runner');2console.log(bold('Hello World'));3{4 "scripts": {5 },6 "devDependencies": {7 }8}
Using AI Code Generation
1const bold = require('storybook-test-runner').bold;2console.log(bold('Hello World!'));3const bold = require('storybook-test-runner').bold;4console.log(bold('Hello World!'));5const bold = require('storybook-test-runner').bold;6console.log(bold('Hello World!'));7const bold = require('storybook-test-runner').bold;8console.log(bold('Hello World!'));9const bold = require('storybook-test-runner').bold;10console.log(bold('Hello World!'));11const bold = require('storybook-test-runner').bold;12console.log(bold('Hello World!'));13const bold = require('storybook-test-runner').bold;14console.log(bold('Hello World!'));15const bold = require('storybook-test-runner').bold;16console.log(bold('Hello World!'));17const bold = require('storybook-test-runner').bold;18console.log(bold('Hello World!'));19const bold = require('storybook-test-runner').bold;20console.log(bold('Hello World!'));21const bold = require('storybook-test-runner').bold;22console.log(bold('Hello World!'));23const bold = require('storybook-test-runner').bold;24console.log(bold('Hello World!'));25const bold = require('storybook-test-runner').bold;26console.log(bold('Hello World!'));27const bold = require('
Using AI Code Generation
1import { bold } from 'storybook-test-runner';2console.log(bold('Hello World!'));3import { underline } from 'storybook-test-runner';4console.log(underline('Hello World!'));5import { inverse } from 'storybook-test-runner';6console.log(inverse('Hello World!'));7import { strikethrough } from 'storybook-test-runner';8console.log(strikethrough('Hello World!'));9import { black } from 'storybook-test-runner';10console.log(black('Hello World!'));11import { red } from 'storybook-test-runner';12console.log(red('Hello World!'));13import { green } from 'storybook-test-runner';14console.log(green('Hello World!'));15import { yellow } from 'storybook-test-runner';16console.log(yellow('Hello World!'));17import { blue } from 'storybook-test-runner';18console.log(blue('Hello World!'));19import { magenta } from 'storybook-test-runner';20console.log(magenta('Hello World!'));21import { cyan } from 'storybook-test-runner';22console.log(cyan('Hello World!'));23import { white } from 'storybook-test-runner';24console.log(white('Hello World
Using AI Code Generation
1import { bold } from "storybook-test-runner";2const message = "Hello World";3console.log(bold(message));4import { bold } from "storybook-test-runner";5const message = "Hello World";6console.log(bold(message));7import { bold } from "storybook-test-runner";8const message = "Hello World";9console.log(bold(message));10import { bold } from "storybook-test-runner";11const message = "Hello World";12console.log(bold(message));13import { bold } from "storybook-test-runner";14const message = "Hello World";15console.log(bold(message));16import { bold } from "storybook-test-runner";17const message = "Hello World";18console.log(bold(message));19import { bold } from "storybook-test-runner";20const message = "Hello World";21console.log(bold(message));22import { bold } from "storybook-test-runner";23const message = "Hello World";24console.log(bold(message));25import { bold } from "storybook-test-runner";26const message = "Hello World";27console.log(bold(message));28import { bold } from "storybook-test-runner";29const message = "Hello World";30console.log(bold(message));31import { bold } from "storybook-test-runner";32const message = "Hello World";33console.log(bold(message));34import { bold } from "storybook-test-runner";35const message = "Hello World";36console.log(bold(message));37import { bold } from "storybook-test-runner";
Using AI Code Generation
1var bold = require('storybook-test-runner').bold;2console.log(bold('hello world'));3var bold = require('storybook-test-runner').bold;4console.log(bold('hello world'));5var bold = require('storybook-test-runner').bold;6console.log(bold('hello world'));7var bold = require('storybook-test-runner').bold;8console.log(bold('hello world'));9var bold = require('storybook-test-runner').bold;10console.log(bold('hello world'));11var bold = require('storybook-test-runner').bold;12console.log(bold('hello world'));13var bold = require('storybook-test-runner').bold;14console.log(bold('hello world'));15var bold = require('storybook-test-runner').bold;16console.log(bold('hello world'));17var bold = require('storybook-test-runner').bold;18console.log(bold('hello world'));19var bold = require('storybook-test-runner').bold;20console.log(bold('hello world'));21var bold = require('storybook-test-runner').bold;22console.log(bold('hello world'));23var bold = require('storybook-test-runner').bold;24console.log(bold('hello world'));
Using AI Code Generation
1import {bold} from 'storybook-test-runner';2console.log(bold('Hello World'));3const bold = (text) => {4 return `<b>${text}</b>`5}6module.exports = {7}
Using AI Code Generation
1const { bold } = require('storybook-test-runner');2console.log(bold('Hello World!'));3import { storiesOf } from '@storybook/react';4import { withTests } from 'storybook-addon-jest';5import { withA11y } from '@storybook/addon-a11y';6import { withKnobs } from '@storybook/addon-knobs';7import { withInfo } from '@storybook/addon-info';8import { withBackgrounds } from '@storybook/addon-backgrounds';9import { default as MyComponent } from '../src/MyComponent';10import results from '../.jest-test-results.json';11storiesOf('MyComponent', module)12 .addDecorator(withTests({ results }))13 .addDecorator(withA11y)14 .addDecorator(withKnobs)15 .addDecorator(withInfo)16 .addDecorator(withBackgrounds)17 .add('default', () => <MyComponent />);
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!!