Changeset 47512
- Timestamp:
- 03/27/2020 12:16:58 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/package-lock.json
r47497 r47512 1831 1831 "optional": true 1832 1832 }, 1833 "@sinonjs/commons": { 1834 "version": "1.7.1", 1835 "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.1.tgz", 1836 "integrity": "sha512-Debi3Baff1Qu1Unc3mjJ96MgpbwTn43S1+9yJ0llWygPwDNu2aaWBD6yc9y/Z8XDRNhx7U+u2UDg2OGQXkclUQ==", 1837 "dev": true, 1838 "requires": { 1839 "type-detect": "4.0.8" 1840 } 1841 }, 1842 "@sinonjs/fake-timers": { 1843 "version": "6.0.0", 1844 "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-6.0.0.tgz", 1845 "integrity": "sha512-atR1J/jRXvQAb47gfzSK8zavXy7BcpnYq21ALon0U99etu99vsir0trzIO3wpeLtW+LLVY6X7EkfVTbjGSH8Ww==", 1846 "dev": true, 1847 "requires": { 1848 "@sinonjs/commons": "^1.7.0" 1849 } 1850 }, 1851 "@sinonjs/formatio": { 1852 "version": "5.0.1", 1853 "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-5.0.1.tgz", 1854 "integrity": "sha512-KaiQ5pBf1MpS09MuA0kp6KBQt2JUOQycqVG1NZXvzeaXe5LGFqAKueIS0bw4w0P9r7KuBSVdUk5QjXsUdu2CxQ==", 1855 "dev": true, 1856 "requires": { 1857 "@sinonjs/commons": "^1", 1858 "@sinonjs/samsam": "^5.0.2" 1859 } 1860 }, 1861 "@sinonjs/samsam": { 1862 "version": "5.0.3", 1863 "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.0.3.tgz", 1864 "integrity": "sha512-QucHkc2uMJ0pFGjJUDP3F9dq5dx8QIaqISl9QgwLOh6P9yv877uONPGXh/OH/0zmM3tW1JjuJltAZV2l7zU+uQ==", 1865 "dev": true, 1866 "requires": { 1867 "@sinonjs/commons": "^1.6.0", 1868 "lodash.get": "^4.4.2", 1869 "type-detect": "^4.0.8" 1870 } 1871 }, 1872 "@sinonjs/text-encoding": { 1873 "version": "0.7.1", 1874 "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz", 1875 "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", 1876 "dev": true 1877 }, 1833 1878 "@tannin/compile": { 1834 1879 "version": "1.1.0", … … 4590 4635 "integrity": "sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA==", 4591 4636 "dev": true, 4592 "optional": true,4593 4637 "requires": { 4594 4638 "p-finally": "^1.0.0" … … 4635 4679 "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", 4636 4680 "dev": true, 4637 "optional": true,4638 4681 "requires": { 4639 4682 "readable-stream": "^2.3.5", … … 4928 4971 "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", 4929 4972 "dev": true, 4930 "optional": true,4931 4973 "requires": { 4932 4974 "buffer-alloc-unsafe": "^1.1.0", … … 4938 4980 "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", 4939 4981 "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", 4940 "dev": true, 4941 "optional": true 4982 "dev": true 4942 4983 }, 4943 4984 "buffer-crc32": { … … 4945 4986 "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", 4946 4987 "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", 4947 "dev": true, 4948 "optional": true 4988 "dev": true 4949 4989 }, 4950 4990 "buffer-fill": { … … 4952 4992 "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", 4953 4993 "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", 4954 "dev": true, 4955 "optional": true 4994 "dev": true 4956 4995 }, 4957 4996 "buffer-from": { … … 5213 5252 "integrity": "sha512-Cg8/ZSBEa8ZVY9HspcGUYaK63d/bN7rqS3CYCzEGUxuYv6UlmcjzDUz2fCFFHyTvUW5Pk0I+3hkA3iXlIj6guA==", 5214 5253 "dev": true, 5215 "optional": true,5216 5254 "requires": { 5217 5255 "get-proxy": "^2.0.0", … … 5348 5386 }, 5349 5387 "minimist": { 5350 "version": "1.2. 0",5351 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2. 0.tgz",5352 "integrity": "sha 1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",5388 "version": "1.2.5", 5389 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", 5390 "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", 5353 5391 "dev": true 5354 5392 }, … … 5788 5826 "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", 5789 5827 "dev": true, 5790 "optional": true,5791 5828 "requires": { 5792 5829 "ini": "^1.3.4", … … 6479 6516 }, 6480 6517 "minimist": { 6481 "version": "1.2. 0",6482 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2. 0.tgz",6483 "integrity": "sha 1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",6518 "version": "1.2.5", 6519 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", 6520 "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", 6484 6521 "dev": true 6485 6522 }, … … 6554 6591 "integrity": "sha1-eu3YVCflqS2s/lVnSnxQXpbQH50=", 6555 6592 "dev": true, 6556 "optional": true,6557 6593 "requires": { 6558 6594 "decompress-tar": "^4.0.0", … … 6571 6607 "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", 6572 6608 "dev": true, 6573 "optional": true,6574 6609 "requires": { 6575 6610 "pify": "^3.0.0" … … 6580 6615 "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", 6581 6616 "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", 6582 "dev": true, 6583 "optional": true 6617 "dev": true 6584 6618 } 6585 6619 } … … 6589 6623 "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", 6590 6624 "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", 6591 "dev": true, 6592 "optional": true 6625 "dev": true 6593 6626 } 6594 6627 } … … 6599 6632 "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", 6600 6633 "dev": true, 6601 "optional": true,6602 6634 "requires": { 6603 6635 "mimic-response": "^1.0.0" … … 6609 6641 "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", 6610 6642 "dev": true, 6611 "optional": true,6612 6643 "requires": { 6613 6644 "file-type": "^5.2.0", … … 6620 6651 "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", 6621 6652 "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=", 6622 "dev": true, 6623 "optional": true 6653 "dev": true 6624 6654 } 6625 6655 } … … 6630 6660 "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", 6631 6661 "dev": true, 6632 "optional": true,6633 6662 "requires": { 6634 6663 "decompress-tar": "^4.1.0", … … 6643 6672 "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", 6644 6673 "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==", 6645 "dev": true, 6646 "optional": true 6674 "dev": true 6647 6675 } 6648 6676 } … … 6653 6681 "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", 6654 6682 "dev": true, 6655 "optional": true,6656 6683 "requires": { 6657 6684 "decompress-tar": "^4.1.1", … … 6664 6691 "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", 6665 6692 "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=", 6666 "dev": true, 6667 "optional": true 6693 "dev": true 6668 6694 } 6669 6695 } … … 6674 6700 "integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=", 6675 6701 "dev": true, 6676 "optional": true,6677 6702 "requires": { 6678 6703 "file-type": "^3.8.0", … … 6687 6712 "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", 6688 6713 "dev": true, 6689 "optional": true,6690 6714 "requires": { 6691 6715 "pend": "~1.2.0" … … 6696 6720 "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", 6697 6721 "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=", 6698 "dev": true, 6699 "optional": true 6722 "dev": true 6700 6723 }, 6701 6724 "get-stream": { … … 6704 6727 "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", 6705 6728 "dev": true, 6706 "optional": true,6707 6729 "requires": { 6708 6730 "object-assign": "^4.0.1", … … 6714 6736 "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", 6715 6737 "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", 6716 "dev": true, 6717 "optional": true 6738 "dev": true 6718 6739 }, 6719 6740 "yauzl": { … … 6722 6743 "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", 6723 6744 "dev": true, 6724 "optional": true,6725 6745 "requires": { 6726 6746 "buffer-crc32": "~0.2.3", … … 6901 6921 }, 6902 6922 "kind-of": { 6903 "version": "6.0. 2",6904 "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0. 2.tgz",6905 "integrity": "sha512- s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",6923 "version": "6.0.3", 6924 "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", 6925 "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", 6906 6926 "dev": true 6907 6927 } … … 7228 7248 "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", 7229 7249 "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", 7230 "dev": true, 7231 "optional": true 7250 "dev": true 7232 7251 } 7233 7252 } … … 7261 7280 "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", 7262 7281 "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", 7263 "dev": true, 7264 "optional": true 7282 "dev": true 7265 7283 }, 7266 7284 "duplexify": { … … 8253 8271 "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", 8254 8272 "dev": true, 8255 "optional": true,8256 8273 "requires": { 8257 8274 "cross-spawn": "^5.0.1", … … 8416 8433 "integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==", 8417 8434 "dev": true, 8418 "optional": true,8419 8435 "requires": { 8420 8436 "mime-db": "^1.28.0" … … 8426 8442 "integrity": "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ==", 8427 8443 "dev": true, 8428 "optional": true,8429 8444 "requires": { 8430 8445 "ext-list": "^2.0.0", … … 8697 8712 "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", 8698 8713 "integrity": "sha1-q/c9+rc10EVECr/qLZHzieu/oik=", 8699 "dev": true, 8700 "optional": true 8714 "dev": true 8701 8715 }, 8702 8716 "filenamify": { … … 8705 8719 "integrity": "sha512-ICw7NTT6RsDp2rnYKVd8Fu4cr6ITzGy3+u4vUujPkabyaz+03F24NWEX7fs5fp+kBonlaqPH8fAO2NM+SXt/JA==", 8706 8720 "dev": true, 8707 "optional": true,8708 8721 "requires": { 8709 8722 "filename-reserved-regex": "^2.0.0", … … 9098 9111 "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", 9099 9112 "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", 9100 "dev": true, 9101 "optional": true 9113 "dev": true 9102 9114 }, 9103 9115 "fs-exists-sync": { … … 9155 9167 "version": "2.1.1", 9156 9168 "bundled": true, 9157 "dev": true, 9158 "optional": true 9169 "dev": true 9159 9170 }, 9160 9171 "aproba": { … … 9177 9188 "version": "1.0.0", 9178 9189 "bundled": true, 9179 "dev": true, 9180 "optional": true 9190 "dev": true 9181 9191 }, 9182 9192 "brace-expansion": { … … 9184 9194 "bundled": true, 9185 9195 "dev": true, 9186 "optional": true,9187 9196 "requires": { 9188 9197 "balanced-match": "^1.0.0", … … 9199 9208 "version": "1.1.0", 9200 9209 "bundled": true, 9201 "dev": true, 9202 "optional": true 9210 "dev": true 9203 9211 }, 9204 9212 "concat-map": { 9205 9213 "version": "0.0.1", 9206 9214 "bundled": true, 9207 "dev": true, 9208 "optional": true 9215 "dev": true 9209 9216 }, 9210 9217 "console-control-strings": { 9211 9218 "version": "1.1.0", 9212 9219 "bundled": true, 9213 "dev": true, 9214 "optional": true 9220 "dev": true 9215 9221 }, 9216 9222 "core-util-is": { … … 9329 9335 "version": "2.0.3", 9330 9336 "bundled": true, 9331 "dev": true, 9332 "optional": true 9337 "dev": true 9333 9338 }, 9334 9339 "ini": { … … 9342 9347 "bundled": true, 9343 9348 "dev": true, 9344 "optional": true,9345 9349 "requires": { 9346 9350 "number-is-nan": "^1.0.0" … … 9357 9361 "bundled": true, 9358 9362 "dev": true, 9359 "optional": true,9360 9363 "requires": { 9361 9364 "brace-expansion": "^1.1.7" … … 9365 9368 "version": "0.0.8", 9366 9369 "bundled": true, 9367 "dev": true, 9368 "optional": true 9370 "dev": true 9369 9371 }, 9370 9372 "minipass": { … … 9372 9374 "bundled": true, 9373 9375 "dev": true, 9374 "optional": true,9375 9376 "requires": { 9376 9377 "safe-buffer": "^5.1.2", … … 9391 9392 "bundled": true, 9392 9393 "dev": true, 9393 "optional": true,9394 9394 "requires": { 9395 9395 "minimist": "0.0.8" … … 9472 9472 "version": "1.0.1", 9473 9473 "bundled": true, 9474 "dev": true, 9475 "optional": true 9474 "dev": true 9476 9475 }, 9477 9476 "object-assign": { … … 9485 9484 "bundled": true, 9486 9485 "dev": true, 9487 "optional": true,9488 9486 "requires": { 9489 9487 "wrappy": "1" … … 9571 9569 "version": "5.1.2", 9572 9570 "bundled": true, 9573 "dev": true, 9574 "optional": true 9571 "dev": true 9575 9572 }, 9576 9573 "safer-buffer": { … … 9608 9605 "bundled": true, 9609 9606 "dev": true, 9610 "optional": true,9611 9607 "requires": { 9612 9608 "code-point-at": "^1.0.0", … … 9628 9624 "bundled": true, 9629 9625 "dev": true, 9630 "optional": true,9631 9626 "requires": { 9632 9627 "ansi-regex": "^2.0.0" … … 9672 9667 "version": "1.0.2", 9673 9668 "bundled": true, 9674 "dev": true, 9675 "optional": true 9669 "dev": true 9676 9670 }, 9677 9671 "yallist": { 9678 9672 "version": "3.0.3", 9679 9673 "bundled": true, 9680 "dev": true, 9681 "optional": true 9674 "dev": true 9682 9675 } 9683 9676 } … … 9848 9841 "integrity": "sha512-zmZIaQTWnNQb4R4fJUEp/FC51eZsc6EkErspy3xtIYStaq8EB/hDIWipxsal+E8rz0qD7f2sL/NA9Xee4RInJw==", 9849 9842 "dev": true, 9850 "optional": true,9851 9843 "requires": { 9852 9844 "npm-conf": "^1.1.0" … … 9871 9863 "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", 9872 9864 "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", 9873 "dev": true, 9874 "optional": true 9865 "dev": true 9875 9866 }, 9876 9867 "get-value": { … … 10257 10248 "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", 10258 10249 "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", 10259 "dev": true, 10260 "optional": true 10250 "dev": true 10261 10251 }, 10262 10252 "gradient-parser": { … … 11009 10999 "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", 11010 11000 "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==", 11011 "dev": true, 11012 "optional": true 11001 "dev": true 11013 11002 }, 11014 11003 "has-symbols": { … … 11022 11011 "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", 11023 11012 "dev": true, 11024 "optional": true,11025 11013 "requires": { 11026 11014 "has-symbol-support-x": "^1.4.1" … … 12148 12136 "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", 12149 12137 "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=", 12150 "dev": true, 12151 "optional": true 12138 "dev": true 12152 12139 }, 12153 12140 "is-number": { … … 12176 12163 "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", 12177 12164 "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", 12178 "dev": true, 12179 "optional": true 12165 "dev": true 12180 12166 }, 12181 12167 "is-path-cwd": { … … 12254 12240 "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", 12255 12241 "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", 12256 "dev": true, 12257 "optional": true 12242 "dev": true 12258 12243 }, 12259 12244 "is-stream": { … … 12486 12471 "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", 12487 12472 "dev": true, 12488 "optional": true,12489 12473 "requires": { 12490 12474 "has-to-string-tag-x": "^1.2.0", … … 13797 13781 "resolved": "https://registry.npmjs.org/js-polyfills/-/js-polyfills-0.1.42.tgz", 13798 13782 "integrity": "sha1-XUhJArNh489gH9I60PMLr8yT8Ug=" 13783 }, 13784 "js-reporters": { 13785 "version": "1.2.1", 13786 "resolved": "https://registry.npmjs.org/js-reporters/-/js-reporters-1.2.1.tgz", 13787 "integrity": "sha1-+IxgjjJKM3OpW8xFrTBeXJecRZs=", 13788 "dev": true 13799 13789 }, 13800 13790 "js-tokens": { … … 14102 14092 } 14103 14093 }, 14094 "just-extend": { 14095 "version": "4.1.0", 14096 "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.0.tgz", 14097 "integrity": "sha512-ApcjaOdVTJ7y4r08xI5wIqpvwS48Q0PBG4DJROcEkH1f8MdAiNFyFxz3xoL0LWAVwjrwPYZdVHHxhRHcx/uGLA==", 14098 "dev": true 14099 }, 14104 14100 "kew": { 14105 14101 "version": "0.7.0", … … 14281 14277 }, 14282 14278 "minimist": { 14283 "version": "1.2. 0",14284 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2. 0.tgz",14285 "integrity": "sha 1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",14279 "version": "1.2.5", 14280 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", 14281 "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", 14286 14282 "dev": true 14287 14283 } … … 14326 14322 "dev": true 14327 14323 }, 14324 "lodash.get": { 14325 "version": "4.4.2", 14326 "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", 14327 "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", 14328 "dev": true 14329 }, 14328 14330 "lodash.isequal": { 14329 14331 "version": "4.5.0", … … 14477 14479 "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", 14478 14480 "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", 14479 "dev": true, 14480 "optional": true 14481 "dev": true 14481 14482 }, 14482 14483 "lpad-align": { … … 14515 14516 "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", 14516 14517 "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", 14517 "dev": true, 14518 "optional": true 14518 "dev": true 14519 14519 }, 14520 14520 "indent-string": { … … 14523 14523 "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", 14524 14524 "dev": true, 14525 "optional": true,14526 14525 "requires": { 14527 14526 "repeating": "^2.0.0" … … 14532 14531 "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", 14533 14532 "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", 14534 "dev": true, 14535 "optional": true 14533 "dev": true 14536 14534 }, 14537 14535 "meow": { … … 14555 14553 }, 14556 14554 "minimist": { 14557 "version": "1.2. 0",14558 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2. 0.tgz",14559 "integrity": "sha 1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",14555 "version": "1.2.5", 14556 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", 14557 "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", 14560 14558 "dev": true, 14561 14559 "optional": true … … 14996 14994 "dependencies": { 14997 14995 "kind-of": { 14998 "version": "6.0. 2",14999 "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0. 2.tgz",15000 "integrity": "sha512- s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",14996 "version": "6.0.3", 14997 "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", 14998 "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", 15001 14999 "dev": true 15002 15000 } … … 15044 15042 "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", 15045 15043 "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", 15046 "dev": true, 15047 "optional": true 15044 "dev": true 15048 15045 }, 15049 15046 "min-indent": { … … 15264 15261 "dependencies": { 15265 15262 "kind-of": { 15266 "version": "6.0. 2",15267 "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0. 2.tgz",15268 "integrity": "sha512- s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",15263 "version": "6.0.3", 15264 "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", 15265 "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", 15269 15266 "dev": true 15270 15267 } … … 15318 15315 "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", 15319 15316 "dev": true 15317 }, 15318 "nise": { 15319 "version": "4.0.3", 15320 "resolved": "https://registry.npmjs.org/nise/-/nise-4.0.3.tgz", 15321 "integrity": "sha512-EGlhjm7/4KvmmE6B/UFsKh7eHykRl9VH+au8dduHLCyWUO/hr7+N+WtTvDUwc9zHuM1IaIJs/0lQ6Ag1jDkQSg==", 15322 "dev": true, 15323 "requires": { 15324 "@sinonjs/commons": "^1.7.0", 15325 "@sinonjs/fake-timers": "^6.0.0", 15326 "@sinonjs/text-encoding": "^0.7.1", 15327 "just-extend": "^4.0.2", 15328 "path-to-regexp": "^1.7.0" 15329 }, 15330 "dependencies": { 15331 "isarray": { 15332 "version": "0.0.1", 15333 "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", 15334 "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", 15335 "dev": true 15336 }, 15337 "path-to-regexp": { 15338 "version": "1.8.0", 15339 "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", 15340 "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", 15341 "dev": true, 15342 "requires": { 15343 "isarray": "0.0.1" 15344 } 15345 } 15346 } 15320 15347 }, 15321 15348 "node-fetch": { … … 15518 15545 }, 15519 15546 "minimist": { 15520 "version": "1.2. 0",15521 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2. 0.tgz",15522 "integrity": "sha 1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",15547 "version": "1.2.5", 15548 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", 15549 "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", 15523 15550 "dev": true 15524 15551 }, … … 15550 15577 } 15551 15578 }, 15579 "node-watch": { 15580 "version": "0.6.1", 15581 "resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.6.1.tgz", 15582 "integrity": "sha512-gwQiR7weFRV8mAtT0x0kXkZ18dfRLB45xH7q0hCOVQMLfLb2f1ZaSvR57q4/b/Vj6B0RwMNJYbvb69e1yM7qEA==", 15583 "dev": true 15584 }, 15552 15585 "nopt": { 15553 15586 "version": "3.0.6", … … 15600 15633 "integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==", 15601 15634 "dev": true, 15602 "optional": true,15603 15635 "requires": { 15604 15636 "config-chain": "^1.1.11", … … 15610 15642 "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", 15611 15643 "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", 15612 "dev": true, 15613 "optional": true 15644 "dev": true 15614 15645 } 15615 15646 } … … 16347 16378 "integrity": "sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=", 16348 16379 "dev": true, 16349 "optional": true,16350 16380 "requires": { 16351 16381 "p-finally": "^1.0.0" … … 17519 17549 "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", 17520 17550 "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=", 17521 "dev": true, 17522 "optional": true 17551 "dev": true 17523 17552 }, 17524 17553 "proxy-addr": { … … 17712 17741 "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", 17713 17742 "dev": true 17743 }, 17744 "qunit": { 17745 "version": "2.9.3", 17746 "resolved": "https://registry.npmjs.org/qunit/-/qunit-2.9.3.tgz", 17747 "integrity": "sha512-RH4VYSaVsNRDthMFFboTJAJ8q4kJM5LvOqWponKUYPEAeOcmc/YFV1QsZ7ikknA3TjqliWFJYEV63vvVXaALmQ==", 17748 "dev": true, 17749 "requires": { 17750 "commander": "2.12.2", 17751 "js-reporters": "1.2.1", 17752 "minimatch": "3.0.4", 17753 "node-watch": "0.6.1", 17754 "resolve": "1.9.0" 17755 }, 17756 "dependencies": { 17757 "commander": { 17758 "version": "2.12.2", 17759 "resolved": "https://registry.npmjs.org/commander/-/commander-2.12.2.tgz", 17760 "integrity": "sha512-BFnaq5ZOGcDN7FlrtBT4xxkgIToalIIxwjxLWVJ8bGTpe1LroqMiqQXdA7ygc7CRvaYS+9zfPGFnJqFSayx+AA==", 17761 "dev": true 17762 }, 17763 "resolve": { 17764 "version": "1.9.0", 17765 "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.9.0.tgz", 17766 "integrity": "sha512-TZNye00tI67lwYvzxCxHGjwTNlUV70io54/Ed4j6PscB8xVfuBJpRenI/o6dVk0cY0PYTY27AgCoGGxRnYuItQ==", 17767 "dev": true, 17768 "requires": { 17769 "path-parse": "^1.0.6" 17770 } 17771 } 17772 } 17714 17773 }, 17715 17774 "raf": { … … 19005 19064 "integrity": "sha1-z+kXyz0nS8/6x5J1ivUxc+sfq9w=", 19006 19065 "dev": true, 19007 "optional": true,19008 19066 "requires": { 19009 19067 "commander": "~2.8.1" … … 19015 19073 "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", 19016 19074 "dev": true, 19017 "optional": true,19018 19075 "requires": { 19019 19076 "graceful-readlink": ">= 1.0.0" … … 19363 19420 } 19364 19421 }, 19422 "sinon": { 19423 "version": "9.0.1", 19424 "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.0.1.tgz", 19425 "integrity": "sha512-iTTyiQo5T94jrOx7X7QLBZyucUJ2WvL9J13+96HMfm2CGoJYbIPqRfl6wgNcqmzk0DI28jeGx5bUTXizkrqBmg==", 19426 "dev": true, 19427 "requires": { 19428 "@sinonjs/commons": "^1.7.0", 19429 "@sinonjs/fake-timers": "^6.0.0", 19430 "@sinonjs/formatio": "^5.0.1", 19431 "@sinonjs/samsam": "^5.0.3", 19432 "diff": "^4.0.2", 19433 "nise": "^4.0.1", 19434 "supports-color": "^7.1.0" 19435 }, 19436 "dependencies": { 19437 "diff": { 19438 "version": "4.0.2", 19439 "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", 19440 "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", 19441 "dev": true 19442 }, 19443 "has-flag": { 19444 "version": "4.0.0", 19445 "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", 19446 "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 19447 "dev": true 19448 }, 19449 "supports-color": { 19450 "version": "7.1.0", 19451 "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", 19452 "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", 19453 "dev": true, 19454 "requires": { 19455 "has-flag": "^4.0.0" 19456 } 19457 } 19458 } 19459 }, 19460 "sinon-test": { 19461 "version": "3.0.0", 19462 "resolved": "https://registry.npmjs.org/sinon-test/-/sinon-test-3.0.0.tgz", 19463 "integrity": "sha512-k2V042JwIS6SC3M8Ih3Uo6+6mlL5FKqvvobxoWQobFkACr61WpyAMKsfqXecLL+DrDD3s9T+eYSZdVQzMH1pkA==", 19464 "dev": true 19465 }, 19365 19466 "sisteransi": { 19366 19467 "version": "1.0.5", … … 19559 19660 "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", 19560 19661 "dev": true, 19561 "optional": true,19562 19662 "requires": { 19563 19663 "is-plain-obj": "^1.0.0" … … 19569 19669 "integrity": "sha1-nLb09OnkgVWmqgZx7dM2/xR5oYg=", 19570 19670 "dev": true, 19571 "optional": true,19572 19671 "requires": { 19573 19672 "sort-keys": "^1.0.0" … … 20195 20294 "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", 20196 20295 "dev": true, 20197 "optional": true,20198 20296 "requires": { 20199 20297 "is-natural-number": "^4.0.1" … … 20226 20324 "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", 20227 20325 "dev": true, 20228 "optional": true,20229 20326 "requires": { 20230 20327 "escape-string-regexp": "^1.0.2" … … 20866 20963 "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", 20867 20964 "dev": true, 20868 "optional": true,20869 20965 "requires": { 20870 20966 "bl": "^1.0.0", … … 20881 20977 "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", 20882 20978 "integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=", 20883 "dev": true, 20884 "optional": true 20979 "dev": true 20885 20980 }, 20886 20981 "tempfile": { … … 20889 20984 "integrity": "sha1-awRGhWqbERTRhW/8vlCczLCXcmU=", 20890 20985 "dev": true, 20891 "optional": true,20892 20986 "requires": { 20893 20987 "temp-dir": "^1.0.0", … … 21049 21143 "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", 21050 21144 "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", 21051 "dev": true, 21052 "optional": true 21145 "dev": true 21053 21146 }, 21054 21147 "timers-browserify": { … … 21133 21226 "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", 21134 21227 "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==", 21135 "dev": true, 21136 "optional": true 21228 "dev": true 21137 21229 }, 21138 21230 "to-fast-properties": { … … 21266 21358 "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=", 21267 21359 "dev": true, 21268 "optional": true,21269 21360 "requires": { 21270 21361 "escape-string-regexp": "^1.0.2" … … 21391 21482 } 21392 21483 }, 21484 "type-detect": { 21485 "version": "4.0.8", 21486 "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", 21487 "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", 21488 "dev": true 21489 }, 21393 21490 "type-fest": { 21394 21491 "version": "0.8.1", … … 21488 21585 "integrity": "sha512-fUlAF7U9Ah1Q6EieQ4x4zLNejrRvDWUYmxXUpN3uziFYCHapjWFaCAnreY9bGgxzaMCFAPPpYNng57CypwJVhg==", 21489 21586 "dev": true, 21490 "optional": true,21491 21587 "requires": { 21492 21588 "buffer": "^5.2.1", … … 21499 21595 "integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==", 21500 21596 "dev": true, 21501 "optional": true,21502 21597 "requires": { 21503 21598 "base64-js": "^1.0.2", … … 21799 21894 "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", 21800 21895 "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=", 21801 "dev": true, 21802 "optional": true 21896 "dev": true 21803 21897 }, 21804 21898 "use": { … … 21986 22080 }, 21987 22081 "minimist": { 21988 "version": "1.2. 0",21989 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2. 0.tgz",21990 "integrity": "sha 1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",22082 "version": "1.2.5", 22083 "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", 22084 "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", 21991 22085 "dev": true 21992 22086 } … … 22128 22222 "dependencies": { 22129 22223 "acorn": { 22130 "version": "6. 3.0",22131 "resolved": "https://registry.npmjs.org/acorn/-/acorn-6. 3.0.tgz",22132 "integrity": "sha512- /czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==",22224 "version": "6.4.1", 22225 "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", 22226 "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", 22133 22227 "dev": true 22134 22228 }, -
trunk/package.json
r47497 r47512 64 64 "matchdep": "~2.0.0", 65 65 "node-sass": "~4.13.1", 66 "qunit": "~2.9.0", 67 "sinon": "~9.0.0", 68 "sinon-test": "~3.0.0", 66 69 "source-map-loader": "^0.2.4", 67 70 "uglify-js": "^3.6.0", -
trunk/tests/qunit/index.html
r47233 r47512 57 57 58 58 <!-- QUnit --> 59 <link rel="stylesheet" href="vendor/qunit.css" type="text/css" media="screen" /> 60 <script src="vendor/qunit.js"></script> 61 <script src="vendor/sinon.js"></script> 62 <script src="vendor/sinon-qunit.js"></script> 63 <script>QUnit.config.hidepassed = false;</script> 59 <link rel="stylesheet" href="../../node_modules/qunit/qunit/qunit.css" type="text/css" media="screen" /> 60 <script src="../../node_modules/qunit/qunit/qunit.js"></script> 61 <script src="../../node_modules/sinon/pkg/sinon.js"></script> 62 <script src="../../node_modules/sinon-test/dist/sinon-test.js"></script> 63 <script> 64 var qTest = QUnit.test, sTest = sinonTest( sinon ); 65 66 QUnit.config.hidepassed = false; 67 68 QUnit.test = function( testName, callback ) { 69 return qTest( testName, sTest(callback) ); 70 }; 71 </script> 64 72 </head> 65 73 <body> -
trunk/tests/qunit/wp-admin/js/customize-base.js
r47122 r47512 1 /* global wp , test, ok, equal, module*/1 /* global wp */ 2 2 3 3 jQuery( function( $ ) { … … 5 5 firstInitialValue, firstValueInstance, valuesInstance, wasCallbackFired, mockValueCallback; 6 6 7 module( 'Customize Base: Class' );7 QUnit.module( 'Customize Base: Class' ); 8 8 9 9 FooSuperClass = wp.customize.Class.extend( 10 10 { 11 initialize: function 11 initialize: function( instanceProps ) { 12 12 $.extend( this, instanceProps || {} ); 13 13 }, … … 18 18 } 19 19 ); 20 test( 'FooSuperClass is a function ', function () {21 equal( typeof FooSuperClass, 'function' );22 }); 23 test( 'FooSuperClass prototype has protoProp', function () {24 equal( FooSuperClass.prototype.protoProp, 'protoPropValue' );25 }); 26 test( 'FooSuperClass does not have protoProp', function () {27 equal( typeof FooSuperClass.protoProp, 'undefined' );28 }); 29 test( 'FooSuperClass has staticProp', function () {30 equal( FooSuperClass.staticProp, 'staticPropValue' );31 }); 32 test( 'FooSuperClass prototype does not have staticProp', function () {33 equal( typeof FooSuperClass.prototype.staticProp, 'undefined' );20 QUnit.test( 'FooSuperClass is a function', function( assert ) { 21 assert.equal( typeof FooSuperClass, 'function' ); 22 }); 23 QUnit.test( 'FooSuperClass prototype has protoProp', function( assert ) { 24 assert.equal( FooSuperClass.prototype.protoProp, 'protoPropValue' ); 25 }); 26 QUnit.test( 'FooSuperClass does not have protoProp', function( assert ) { 27 assert.equal( typeof FooSuperClass.protoProp, 'undefined' ); 28 }); 29 QUnit.test( 'FooSuperClass has staticProp', function( assert ) { 30 assert.equal( FooSuperClass.staticProp, 'staticPropValue' ); 31 }); 32 QUnit.test( 'FooSuperClass prototype does not have staticProp', function( assert ) { 33 assert.equal( typeof FooSuperClass.prototype.staticProp, 'undefined' ); 34 34 }); 35 35 36 36 foo = new FooSuperClass( { instanceProp: 'instancePropValue' } ); 37 test( 'FooSuperClass instance foo extended Class', function () {38 equal( foo.extended( wp.customize.Class ), true );39 }); 40 test( 'foo instance has protoProp', function () {41 equal( foo.protoProp, 'protoPropValue' );42 }); 43 test( 'foo instance does not have staticProp', function () {44 equal( typeof foo.staticProp, 'undefined' );45 }); 46 test( 'FooSuperClass instance foo ran initialize() and has supplied instanceProp', function () {47 equal( foo.instanceProp, 'instancePropValue' );37 QUnit.test( 'FooSuperClass instance foo extended Class', function( assert ) { 38 assert.equal( foo.extended( wp.customize.Class ), true ); 39 }); 40 QUnit.test( 'foo instance has protoProp', function( assert ) { 41 assert.equal( foo.protoProp, 'protoPropValue' ); 42 }); 43 QUnit.test( 'foo instance does not have staticProp', function( assert ) { 44 assert.equal( typeof foo.staticProp, 'undefined' ); 45 }); 46 QUnit.test( 'FooSuperClass instance foo ran initialize() and has supplied instanceProp', function( assert ) { 47 assert.equal( foo.instanceProp, 'instancePropValue' ); 48 48 }); 49 49 … … 51 51 // @todo Do we test object.instance? 52 52 53 module( 'Customize Base: Subclass' );53 QUnit.module( 'Customize Base: Subclass' ); 54 54 55 55 BarSubClass = FooSuperClass.extend( … … 65 65 } 66 66 ); 67 test( 'BarSubClass prototype has subProtoProp', function () {68 equal( BarSubClass.prototype.subProtoProp, 'subProtoPropValue' );69 }); 70 test( 'BarSubClass prototype has parent FooSuperClass protoProp', function () {71 equal( BarSubClass.prototype.protoProp, 'protoPropValue' );67 QUnit.test( 'BarSubClass prototype has subProtoProp', function( assert ) { 68 assert.equal( BarSubClass.prototype.subProtoProp, 'subProtoPropValue' ); 69 }); 70 QUnit.test( 'BarSubClass prototype has parent FooSuperClass protoProp', function( assert ) { 71 assert.equal( BarSubClass.prototype.protoProp, 'protoPropValue' ); 72 72 }); 73 73 74 74 bar = new BarSubClass( { instanceProp: 'instancePropValue' } ); 75 test( 'BarSubClass instance bar its initialize() and parent initialize() run', function () {76 equal( bar.instanceProp, 'instancePropValue' );77 equal( bar.subInstanceProp, 'subInstancePropValue' );78 }); 79 80 test( 'BarSubClass instance bar extended FooSuperClass', function () {81 equal( bar.extended( FooSuperClass ), true );75 QUnit.test( 'BarSubClass instance bar its initialize() and parent initialize() run', function( assert ) { 76 assert.equal( bar.instanceProp, 'instancePropValue' ); 77 assert.equal( bar.subInstanceProp, 'subInstancePropValue' ); 78 }); 79 80 QUnit.test( 'BarSubClass instance bar extended FooSuperClass', function( assert ) { 81 assert.equal( bar.extended( FooSuperClass ), true ); 82 82 }); 83 83 84 84 85 85 // Implements todo: Test Class.constructor() manipulation. 86 module( 'Customize Base: Constructor Manipulation' );86 QUnit.module( 'Customize Base: Constructor Manipulation' ); 87 87 88 88 newConstructor = function ( instanceProps ) { … … 100 100 ); 101 101 102 test( 'New constructor added to class' , function () {103 equal( ConstructorTestClass.prototype.constructor , newConstructor );104 }); 105 test( 'Class with new constructor has protoPropValue' , function () {106 equal( ConstructorTestClass.prototype.protoProp , 'protoPropValue' );102 QUnit.test( 'New constructor added to class', function( assert ) { 103 assert.equal( ConstructorTestClass.prototype.constructor , newConstructor ); 104 }); 105 QUnit.test( 'Class with new constructor has protoPropValue', function( assert ) { 106 assert.equal( ConstructorTestClass.prototype.protoProp , 'protoPropValue' ); 107 107 }); 108 108 109 109 constructorTest = new ConstructorTestClass( { instanceProp: 'instancePropValue' } ); 110 test( 'ConstructorTestClass instance constructorTest has the new constructor', function () {111 equal( constructorTest.constructor, newConstructor );112 }); 113 114 test( 'ConstructorTestClass instance constructorTest extended Class', function () {115 equal( constructorTest.extended( wp.customize.Class ), true );116 }); 117 118 test( 'ConstructorTestClass instance constructorTest has the added instance property', function () {119 equal( constructorTest.instanceProp , 'instancePropValue' );120 }); 121 122 123 module( 'Customize Base: wp.customizer.ensure' );110 QUnit.test( 'ConstructorTestClass instance constructorTest has the new constructor', function( assert ) { 111 assert.equal( constructorTest.constructor, newConstructor ); 112 }); 113 114 QUnit.test( 'ConstructorTestClass instance constructorTest extended Class', function( assert ) { 115 assert.equal( constructorTest.extended( wp.customize.Class ), true ); 116 }); 117 118 QUnit.test( 'ConstructorTestClass instance constructorTest has the added instance property', function( assert ) { 119 assert.equal( constructorTest.instanceProp , 'instancePropValue' ); 120 }); 121 122 123 QUnit.module( 'Customize Base: wp.customizer.ensure' ); 124 124 125 125 $mockElement = $( '<div id="mockElement"></div>' ); 126 126 127 test( 'Handles jQuery argument' , function() {128 equal( wp.customize.ensure( $mockElement ) , $mockElement );127 QUnit.test( 'Handles jQuery argument', function( assert ) { 128 assert.equal( wp.customize.ensure( $mockElement ) , $mockElement ); 129 129 }); 130 130 131 131 mockString = '<div class="mockString"></div>'; 132 132 133 test( 'Handles string argument' , function() {134 ok( wp.customize.ensure( mockString ) instanceof jQuery );135 }); 136 137 138 module( 'Customize Base: Value Class' );133 QUnit.test( 'Handles string argument', function( assert ) { 134 assert.ok( wp.customize.ensure( mockString ) instanceof jQuery ); 135 }); 136 137 138 QUnit.module( 'Customize Base: Value Class' ); 139 139 140 140 firstInitialValue = true; 141 141 firstValueInstance = new wp.customize.Value( firstInitialValue ); 142 142 143 test( 'Initialized with the right value' , function() {144 equal( firstValueInstance.get() , firstInitialValue );145 }); 146 147 test( '.set() works' , function() {143 QUnit.test( 'Initialized with the right value', function( assert ) { 144 assert.equal( firstValueInstance.get() , firstInitialValue ); 145 }); 146 147 QUnit.test( '.set() works', function( assert ) { 148 148 firstValueInstance.set( false ); 149 equal( firstValueInstance.get() , false );150 }); 151 152 test( '.bind() adds new callback that fires on set()' , function() {149 assert.equal( firstValueInstance.get() , false ); 150 }); 151 152 QUnit.test( '.bind() adds new callback that fires on set()', function( assert ) { 153 153 wasCallbackFired = false; 154 154 mockValueCallback = function() { … … 157 157 firstValueInstance.bind( mockValueCallback ); 158 158 firstValueInstance.set( 'newValue' ); 159 ok( wasCallbackFired );160 }); 161 162 module( 'Customize Base: Values Class' );159 assert.ok( wasCallbackFired ); 160 }); 161 162 QUnit.module( 'Customize Base: Values Class' ); 163 163 164 164 valuesInstance = new wp.customize.Values(); 165 165 166 test( 'Correct events are triggered when adding to or removing from Values collection', function() {166 QUnit.test( 'Correct events are triggered when adding to or removing from Values collection', function( assert ) { 167 167 var hasFooOnAdd = false, 168 168 hasFooOnRemove = false, … … 180 180 } ); 181 181 valuesInstance.add( 'foo', fooValue ); 182 ok( hasFooOnAdd );183 equal( valuePassedToAdd.get(), fooValue.get() );182 assert.ok( hasFooOnAdd ); 183 assert.equal( valuePassedToAdd.get(), fooValue.get() ); 184 184 185 185 // Test events when removing the value. … … 195 195 } ); 196 196 valuesInstance.remove( 'foo' ); 197 ok( hasFooOnRemove );198 equal( valuePassedToRemove.get(), fooValue.get() );199 ok( ! hasFooOnRemoved );200 equal( valuePassedToRemoved.get(), fooValue.get() );197 assert.ok( hasFooOnRemove ); 198 assert.equal( valuePassedToRemove.get(), fooValue.get() ); 199 assert.ok( ! hasFooOnRemoved ); 200 assert.equal( valuePassedToRemoved.get(), fooValue.get() ); 201 201 202 202 // Confirm no events are fired when nonexistent value is removed. 203 203 wasEventFiredOnRemoval = false; 204 204 valuesInstance.remove( 'bar' ); 205 ok( ! wasEventFiredOnRemoval );206 }); 207 208 module( 'Customize Base: Notification' );209 test( 'Notification object exists and has expected properties', function ( assert ) {205 assert.ok( ! wasEventFiredOnRemoval ); 206 }); 207 208 QUnit.module( 'Customize Base: Notification' ); 209 QUnit.test( 'Notification object exists and has expected properties', function ( assert ) { 210 210 var notification = new wp.customize.Notification( 'mycode', { 211 211 'message': 'Hello World', … … 232 232 } ); 233 233 234 module( 'Customize Base: utils.parseQueryString' );235 test( 'wp.customize.utils.parseQueryString works', function( assert ) {234 QUnit.module( 'Customize Base: utils.parseQueryString' ); 235 QUnit.test( 'wp.customize.utils.parseQueryString works', function( assert ) { 236 236 var queryParams; 237 237 queryParams = wp.customize.utils.parseQueryString( 'a=1&b=2' ); -
trunk/tests/qunit/wp-admin/js/customize-controls-utils.js
r46586 r47512 5 5 BubbleTester, BubbleTesterTwoValues, bubbleTesterParent, firstBubbleTester, secondBubbleTester; 6 6 7 module( 'Customizer Model Utility functions' );7 QUnit.module( 'Customizer Model Utility functions' ); 8 8 9 9 trueMockEvent = { … … 17 17 }; 18 18 19 test( 'isKeydownButNotEnterEvent returns true' , function () {20 ok( wp.customize.utils.isKeydownButNotEnterEvent( trueMockEvent ) );19 QUnit.test( 'isKeydownButNotEnterEvent returns true', function( assert ) { 20 assert.ok( wp.customize.utils.isKeydownButNotEnterEvent( trueMockEvent ) ); 21 21 }); 22 22 23 test( 'isKeydownButNotEnterEvent returns false' , function () {24 equal( wp.customize.utils.isKeydownButNotEnterEvent( falseMockEvent ) , false );23 QUnit.test( 'isKeydownButNotEnterEvent returns false', function( assert ) { 24 assert.equal( wp.customize.utils.isKeydownButNotEnterEvent( falseMockEvent ) , false ); 25 25 }); 26 26 … … 37 37 }; 38 38 39 test( 'areElementListsEqual returns true' , function () {40 ok( wp.customize.utils.areElementListsEqual( mockElementLists.first , mockElementLists.first ) );39 QUnit.test( 'areElementListsEqual returns true', function( assert ) { 40 assert.ok( wp.customize.utils.areElementListsEqual( mockElementLists.first , mockElementLists.first ) ); 41 41 }); 42 42 43 test( 'areElementListsEqual returns false' , function () {44 equal( wp.customize.utils.areElementListsEqual( mockElementLists.first , mockElementLists.second ) , false );43 QUnit.test( 'areElementListsEqual returns false', function( assert ) { 44 assert.equal( wp.customize.utils.areElementListsEqual( mockElementLists.first , mockElementLists.second ) , false ); 45 45 }); 46 46 47 test( 'areElementListsEqual: lists have same values, but in reverse order' , function () {48 equal( wp.customize.utils.areElementListsEqual( mockElementLists.first , mockElementLists.firstInReverseOrder ) , false );47 QUnit.test( 'areElementListsEqual: lists have same values, but in reverse order', function( assert ) { 48 assert.equal( wp.customize.utils.areElementListsEqual( mockElementLists.first , mockElementLists.firstInReverseOrder ) , false ); 49 49 }); 50 50 51 test( 'areElementListsEqual: lists have same values, but one is longer' , function () {52 equal( wp.customize.utils.areElementListsEqual( mockElementLists.third , mockElementLists.thirdButLonger ) , false );51 QUnit.test( 'areElementListsEqual: lists have same values, but one is longer', function( assert ) { 52 assert.equal( wp.customize.utils.areElementListsEqual( mockElementLists.third , mockElementLists.thirdButLonger ) , false ); 53 53 }); 54 54 … … 73 73 ); 74 74 75 test( 'bubbleChildValueChanges notifies parent of change' , function() {75 QUnit.test( 'bubbleChildValueChanges notifies parent of change', function( assert ) { 76 76 firstBubbleTester = new BubbleTester(); 77 77 wp.customize.utils.bubbleChildValueChanges( firstBubbleTester , [ 'fooValue' ] ); 78 78 firstBubbleTester.fooValue.set( 'new value' ); 79 ok( firstBubbleTester.parent.wasChangeTriggered );79 assert.ok( firstBubbleTester.parent.wasChangeTriggered ); 80 80 }); 81 81 82 test( 'bubbleChildValueChanges passes a reference to its instance' , function() {83 ok( firstBubbleTester.parent.instancePassedInTrigger instanceof BubbleTester );82 QUnit.test( 'bubbleChildValueChanges passes a reference to its instance', function( assert ) { 83 assert.ok( firstBubbleTester.parent.instancePassedInTrigger instanceof BubbleTester ); 84 84 }); 85 85 … … 99 99 secondBubbleTester.barValue.set( 'new value' ); 100 100 101 test( 'bubbleChildValueChanges notifies parent of change when two values are bound' , function() {102 ok( secondBubbleTester.parent.wasChangeTriggered );101 QUnit.test( 'bubbleChildValueChanges notifies parent of change when two values are bound', function( assert ) { 102 assert.ok( secondBubbleTester.parent.wasChangeTriggered ); 103 103 }); 104 104 105 test( 'bubbleChildValueChanges passes a reference to its instance when two values are bound' , function() {106 ok( secondBubbleTester.parent.instancePassedInTrigger instanceof BubbleTesterTwoValues );105 QUnit.test( 'bubbleChildValueChanges passes a reference to its instance when two values are bound', function( assert ) { 106 assert.ok( secondBubbleTester.parent.instancePassedInTrigger instanceof BubbleTesterTwoValues ); 107 107 }); 108 108 }); -
trunk/tests/qunit/wp-admin/js/customize-controls.js
r47122 r47512 1 /* global JSON, wp , test, ok, equal, module*/1 /* global JSON, wp */ 2 2 3 3 wp.customize.settingConstructor.abbreviation = wp.customize.Setting.extend({ … … 7 7 }); 8 8 9 jQuery( window ).load( function (){9 jQuery( window ).load( function() { 10 10 'use strict'; 11 11 … … 20 20 } 21 21 var type = expectedValues.type; 22 test( 'Model extends proper type', function () {23 ok( model.extended( wp.customize[ type ] ) );22 QUnit.test( 'Model extends proper type', function( assert ) { 23 assert.ok( model.extended( wp.customize[ type ] ) ); 24 24 } ); 25 25 26 26 if ( expectedValues.hasOwnProperty( 'id' ) ) { 27 test( type + ' instance has the right id', function () {28 equal( model.id, expectedValues.id );27 QUnit.test( type + ' instance has the right id', function( assert ) { 28 assert.equal( model.id, expectedValues.id ); 29 29 }); 30 30 } 31 31 if ( expectedValues.hasOwnProperty( 'title') ) { 32 test( type + ' instance has the right title.', function () {33 equal( model.params.title, expectedValues.title );32 QUnit.test( type + ' instance has the right title.', function( assert ) { 33 assert.equal( model.params.title, expectedValues.title ); 34 34 }); 35 35 } 36 36 if ( expectedValues.hasOwnProperty( 'description' ) ) { 37 test( type + ' instance has the right description.', function () {38 equal( model.params.description, expectedValues.description );37 QUnit.test( type + ' instance has the right description.', function( assert ) { 38 assert.equal( model.params.description, expectedValues.description ); 39 39 }); 40 40 } 41 41 if ( expectedValues.hasOwnProperty( 'content' ) ) { 42 test( type + ' instance has the right content.', function () {43 equal( model.params.content, expectedValues.content );42 QUnit.test( type + ' instance has the right content.', function( assert ) { 43 assert.equal( model.params.content, expectedValues.content ); 44 44 }); 45 45 } 46 46 if ( expectedValues.hasOwnProperty( 'priority' ) ) { 47 test( type + ' instance has the right priority.', function () {48 equal( model.priority(), expectedValues.priority );47 QUnit.test( type + ' instance has the right priority.', function( assert ) { 48 assert.equal( model.priority(), expectedValues.priority ); 49 49 }); 50 50 } 51 51 if ( expectedValues.hasOwnProperty( 'active' ) ) { 52 test( type + ' instance has the right active state.', function () {53 equal( model.active(), expectedValues.active );52 QUnit.test( type + ' instance has the right active state.', function( assert ) { 53 assert.equal( model.active(), expectedValues.active ); 54 54 }); 55 55 } 56 test( type + ' can be deactivated', function () {56 QUnit.test( type + ' can be deactivated', function( assert ) { 57 57 model.activate(); 58 58 model.deactivate(); 59 equal( model.active(), false );59 assert.equal( model.active(), false ); 60 60 model.activate(); 61 equal( model.active(), true );62 ok(true);61 assert.equal( model.active(), true ); 62 assert.ok(true); 63 63 }); 64 64 65 65 if ( type === 'Panel' || type === 'Section' ) { 66 66 if ( expectedValues.hasOwnProperty( 'expanded' ) ) { 67 test( type + ' instance has the right expanded state.', function () {68 equal( model.expanded(), expectedValues.expanded );67 QUnit.test( type + ' instance has the right expanded state.', function( assert ) { 68 assert.equal( model.expanded(), expectedValues.expanded ); 69 69 } ); 70 70 } 71 71 72 test( type + ' instance is collapsed after calling .collapse()', function () {72 QUnit.test( type + ' instance is collapsed after calling .collapse()', function( assert ) { 73 73 model.collapse(); 74 ok( ! model.expanded() );74 assert.ok( ! model.expanded() ); 75 75 }); 76 76 77 test( type + ' instance is expanded after calling .expand()', function () {77 QUnit.test( type + ' instance is expanded after calling .expand()', function( assert ) { 78 78 model.expand(); 79 ok( model.expanded() );79 assert.ok( model.expanded() ); 80 80 }); 81 81 } … … 83 83 }; 84 84 85 module( 'Customizer notifications collection' );86 test( 'Notifications collection exists', function() {87 ok( wp.customize.notifications );88 equal( wp.customize.notifications.defaultConstructor, wp.customize.Notification );89 } ); 90 91 test( 'Notification objects are rendered as part of notifications collection', function() {85 QUnit.module( 'Customizer notifications collection' ); 86 QUnit.test( 'Notifications collection exists', function( assert ) { 87 assert.ok( wp.customize.notifications ); 88 assert.equal( wp.customize.notifications.defaultConstructor, wp.customize.Notification ); 89 } ); 90 91 QUnit.test( 'Notification objects are rendered as part of notifications collection', function( assert ) { 92 92 var container = jQuery( '#customize-notifications-test' ), items, collection; 93 93 … … 98 98 collection.render(); 99 99 items = collection.container.find( 'li' ); 100 equal( items.length, 1 );101 equal( items.first().data( 'code' ), 'mycode-1' );100 assert.equal( items.length, 1 ); 101 assert.equal( items.first().data( 'code' ), 'mycode-1' ); 102 102 103 103 collection.add( 'mycode-2', new wp.customize.Notification( 'mycode-2', { … … 107 107 collection.render(); 108 108 items = collection.container.find( 'li' ); 109 equal( items.length, 2 );110 equal( items.first().data( 'code' ), 'mycode-2' );111 equal( items.last().data( 'code' ), 'mycode-1' );112 113 equal( items.first().find( '.notice-dismiss' ).length, 1 );114 equal( items.last().find( '.notice-dismiss' ).length, 0 );109 assert.equal( items.length, 2 ); 110 assert.equal( items.first().data( 'code' ), 'mycode-2' ); 111 assert.equal( items.last().data( 'code' ), 'mycode-1' ); 112 113 assert.equal( items.first().find( '.notice-dismiss' ).length, 1 ); 114 assert.equal( items.last().find( '.notice-dismiss' ).length, 0 ); 115 115 116 116 collection.remove( 'mycode-2' ); 117 117 collection.render(); 118 118 items = collection.container.find( 'li' ); 119 equal( items.length, 1 );120 equal( items.first().data( 'code' ), 'mycode-1' );119 assert.equal( items.length, 1 ); 120 assert.equal( items.first().data( 'code' ), 'mycode-1' ); 121 121 122 122 collection.remove( 'mycode-1' ); 123 123 collection.render(); 124 ok( collection.container.is( ':hidden' ), 'Notifications area is hidden.' );125 } ); 126 127 module( 'Customizer Previewed Device' );128 test( 'Previewed device defaults to desktop.', function () {129 equal( wp.customize.previewedDevice.get(), 'desktop' );130 } ); 131 132 module( 'Customizer Setting in Fixture' );133 test( 'Setting has fixture value', function () {134 equal( wp.customize( 'fixture-setting' )(), 'Lorem Ipsum' );135 } ); 136 test( 'Setting has notifications', function () {124 assert.ok( collection.container.is( ':hidden' ), 'Notifications area is hidden.' ); 125 } ); 126 127 QUnit.module( 'Customizer Previewed Device' ); 128 QUnit.test( 'Previewed device defaults to desktop.', function( assert ) { 129 assert.equal( wp.customize.previewedDevice.get(), 'desktop' ); 130 } ); 131 132 QUnit.module( 'Customizer Setting in Fixture' ); 133 QUnit.test( 'Setting has fixture value', function( assert ) { 134 assert.equal( wp.customize( 'fixture-setting' )(), 'Lorem Ipsum' ); 135 } ); 136 QUnit.test( 'Setting has notifications', function( assert ) { 137 137 var setting = wp.customize( 'fixture-setting' ); 138 ok( setting.notifications.extended( wp.customize.Values ) );139 equal( wp.customize.Notification, setting.notifications.prototype.constructor.defaultConstructor );140 } ); 141 test( 'Setting has findControls method', function() {138 assert.ok( setting.notifications.extended( wp.customize.Values ) ); 139 assert.equal( wp.customize.Notification, setting.notifications.prototype.constructor.defaultConstructor ); 140 } ); 141 QUnit.test( 'Setting has findControls method', function( assert ) { 142 142 var controls, setting = wp.customize( 'fixture-setting' ); 143 equal( 'function', typeof setting.findControls );143 assert.equal( 'function', typeof setting.findControls ); 144 144 controls = setting.findControls(); 145 equal( 1, controls.length );146 equal( 'fixture-control', controls[0].id );147 } ); 148 test( 'Setting constructor object exists', function( assert ) {145 assert.equal( 1, controls.length ); 146 assert.equal( 'fixture-control', controls[0].id ); 147 } ); 148 QUnit.test( 'Setting constructor object exists', function( assert ) { 149 149 assert.ok( _.isObject( wp.customize.settingConstructor ) ); 150 150 } ); 151 test( 'Custom setting constructor is used', function( assert ) {151 QUnit.test( 'Custom setting constructor is used', function( assert ) { 152 152 var setting = wp.customize( 'fixture-setting-abbr' ); 153 153 assert.ok( setting.extended( wp.customize.settingConstructor.abbreviation ) ); … … 156 156 } ); 157 157 158 module( 'Customizer Control in Fixture' );159 test( 'Control exists', function () {160 ok( wp.customize.control.has( 'fixture-control' ) );161 } ); 162 test( 'Control has the fixture setting', function () {158 QUnit.module( 'Customizer Control in Fixture' ); 159 QUnit.test( 'Control exists', function( assert ) { 160 assert.ok( wp.customize.control.has( 'fixture-control' ) ); 161 } ); 162 QUnit.test( 'Control has the fixture setting', function( assert ) { 163 163 var control = wp.customize.control( 'fixture-control' ); 164 equal( control.setting(), 'Lorem Ipsum' );165 equal( control.setting.id, 'fixture-setting' );166 } ); 167 test( 'Control has the section fixture section ID', function () {164 assert.equal( control.setting(), 'Lorem Ipsum' ); 165 assert.equal( control.setting.id, 'fixture-setting' ); 166 } ); 167 QUnit.test( 'Control has the section fixture section ID', function( assert ) { 168 168 var control = wp.customize.control( 'fixture-control' ); 169 equal( control.section(), 'fixture-section' );170 } ); 171 test( 'Control has notifications', function ( assert ) {169 assert.equal( control.section(), 'fixture-section' ); 170 } ); 171 QUnit.test( 'Control has notifications', function ( assert ) { 172 172 var control = wp.customize.control( 'fixture-control' ), settingNotification, controlOnlyNotification, doneEmbedded; 173 173 assert.ok( control.notifications.extended( wp.customize.Values ) ); … … 216 216 } ); 217 217 218 module( 'Customizer control without associated settings' );219 test( 'Control can be created without settings', function() {218 QUnit.module( 'Customizer control without associated settings' ); 219 QUnit.test( 'Control can be created without settings', function( assert ) { 220 220 var control = new wp.customize.Control( 'settingless', { 221 221 params: { … … 225 225 } ); 226 226 wp.customize.control.add( control.id, control ); 227 equal( control.deferred.embedded.state(), 'resolved' );228 ok( null === control.setting );229 ok( jQuery.isEmptyObject( control.settings ) );227 assert.equal( control.deferred.embedded.state(), 'resolved' ); 228 assert.ok( null === control.setting ); 229 assert.ok( jQuery.isEmptyObject( control.settings ) ); 230 230 } ); 231 231 232 232 // Begin sections. 233 module( 'Customizer Section in Fixture' );234 test( 'Fixture section exists', function () {235 ok( wp.customize.section.has( 'fixture-section' ) );236 } ); 237 test( 'Fixture section has control among controls()', function () {233 QUnit.module( 'Customizer Section in Fixture' ); 234 QUnit.test( 'Fixture section exists', function( assert ) { 235 assert.ok( wp.customize.section.has( 'fixture-section' ) ); 236 } ); 237 QUnit.test( 'Fixture section has control among controls()', function( assert ) { 238 238 var section = wp.customize.section( 'fixture-section' ); 239 ok( -1 !== _.pluck( section.controls(), 'id' ).indexOf( 'fixture-control' ) );240 } ); 241 test( 'Fixture section has has expected panel', function () {239 assert.ok( -1 !== _.pluck( section.controls(), 'id' ).indexOf( 'fixture-control' ) ); 240 } ); 241 QUnit.test( 'Fixture section has has expected panel', function( assert ) { 242 242 var section = wp.customize.section( 'fixture-section' ); 243 equal( section.panel(), 'fixture-panel' );244 } ); 245 246 module( 'Customizer Default Section with Template in Fixture' );247 test( 'Fixture section exists', function () {248 ok( wp.customize.section.has( 'fixture-section-default-templated' ) );249 } ); 250 test( 'Fixture section has expected content', function () {243 assert.equal( section.panel(), 'fixture-panel' ); 244 } ); 245 246 QUnit.module( 'Customizer Default Section with Template in Fixture' ); 247 QUnit.test( 'Fixture section exists', function( assert ) { 248 assert.ok( wp.customize.section.has( 'fixture-section-default-templated' ) ); 249 } ); 250 QUnit.test( 'Fixture section has expected content', function( assert ) { 251 251 var id = 'fixture-section-default-templated', section; 252 252 section = wp.customize.section( id ); 253 ok( ! section.params.content );254 ok( !! section.container );255 ok( !! section.headContainer );256 ok( !! section.contentContainer );257 ok( section.container.has( section.headContainer ) );258 ok( section.container.has( section.contentContainer ) );259 ok( section.headContainer.is( '.control-section.control-section-default' ) );260 ok( 1 === section.headContainer.find( '> .accordion-section-title' ).length );261 ok( section.contentContainer.is( '.accordion-section-content' ) );262 equal( section.headContainer.attr( 'aria-owns' ), section.contentContainer.attr( 'id' ) );263 } ); 264 265 module( 'Customizer Custom Type (titleless) Section with Template in Fixture' );266 test( 'Fixture section exists', function () {267 ok( wp.customize.section.has( 'fixture-section-titleless-templated' ) );268 } ); 269 test( 'Fixture section has expected content', function () {253 assert.ok( ! section.params.content ); 254 assert.ok( !! section.container ); 255 assert.ok( !! section.headContainer ); 256 assert.ok( !! section.contentContainer ); 257 assert.ok( section.container.has( section.headContainer ) ); 258 assert.ok( section.container.has( section.contentContainer ) ); 259 assert.ok( section.headContainer.is( '.control-section.control-section-default' ) ); 260 assert.ok( 1 === section.headContainer.find( '> .accordion-section-title' ).length ); 261 assert.ok( section.contentContainer.is( '.accordion-section-content' ) ); 262 assert.equal( section.headContainer.attr( 'aria-owns' ), section.contentContainer.attr( 'id' ) ); 263 } ); 264 265 QUnit.module( 'Customizer Custom Type (titleless) Section with Template in Fixture' ); 266 QUnit.test( 'Fixture section exists', function( assert ) { 267 assert.ok( wp.customize.section.has( 'fixture-section-titleless-templated' ) ); 268 } ); 269 QUnit.test( 'Fixture section has expected content', function( assert ) { 270 270 var id = 'fixture-section-titleless-templated', section; 271 271 section = wp.customize.section( id ); 272 ok( ! section.params.content );273 ok( !! section.container );274 ok( !! section.headContainer );275 ok( !! section.contentContainer );276 ok( section.container.has( section.headContainer ) );277 ok( section.container.has( section.contentContainer ) );278 ok( section.container.is( '.control-section.control-section-titleless' ) );279 ok( 0 === section.headContainer.find( '> .accordion-section-title' ).length );280 ok( section.contentContainer.is( '.accordion-section-content' ) );281 equal( section.headContainer.attr( 'aria-owns' ), section.contentContainer.attr( 'id' ) );282 } ); 283 module( 'Customizer Custom Type Section Lacking Specific Template' );284 test( 'Fixture section has expected content', function () {272 assert.ok( ! section.params.content ); 273 assert.ok( !! section.container ); 274 assert.ok( !! section.headContainer ); 275 assert.ok( !! section.contentContainer ); 276 assert.ok( section.container.has( section.headContainer ) ); 277 assert.ok( section.container.has( section.contentContainer ) ); 278 assert.ok( section.container.is( '.control-section.control-section-titleless' ) ); 279 assert.ok( 0 === section.headContainer.find( '> .accordion-section-title' ).length ); 280 assert.ok( section.contentContainer.is( '.accordion-section-content' ) ); 281 assert.equal( section.headContainer.attr( 'aria-owns' ), section.contentContainer.attr( 'id' ) ); 282 } ); 283 QUnit.module( 'Customizer Custom Type Section Lacking Specific Template' ); 284 QUnit.test( 'Fixture section has expected content', function( assert ) { 285 285 var id = 'fixture-section-reusing-default-template', section; 286 286 section = wp.customize.section( id ); 287 ok( ! section.params.content );288 ok( !! section.container );289 ok( !! section.headContainer );290 ok( !! section.contentContainer );291 ok( section.container.has( section.headContainer ) );292 ok( section.container.has( section.contentContainer ) );293 ok( section.headContainer.is( '.control-section.control-section-' + section.params.type ) );294 ok( 1 === section.headContainer.find( '> .accordion-section-title' ).length );295 ok( section.contentContainer.is( '.accordion-section-content' ) );296 equal( section.headContainer.attr( 'aria-owns' ), section.contentContainer.attr( 'id' ) );297 } ); 298 module( 'Customizer Section lacking any params' );299 test( 'Fixture section has default params supplied', function () {287 assert.ok( ! section.params.content ); 288 assert.ok( !! section.container ); 289 assert.ok( !! section.headContainer ); 290 assert.ok( !! section.contentContainer ); 291 assert.ok( section.container.has( section.headContainer ) ); 292 assert.ok( section.container.has( section.contentContainer ) ); 293 assert.ok( section.headContainer.is( '.control-section.control-section-' + section.params.type ) ); 294 assert.ok( 1 === section.headContainer.find( '> .accordion-section-title' ).length ); 295 assert.ok( section.contentContainer.is( '.accordion-section-content' ) ); 296 assert.equal( section.headContainer.attr( 'aria-owns' ), section.contentContainer.attr( 'id' ) ); 297 } ); 298 QUnit.module( 'Customizer Section lacking any params' ); 299 QUnit.test( 'Fixture section has default params supplied', function( assert ) { 300 300 var id = 'fixture-section-without-params', section, defaultParams; 301 301 section = wp.customize.section( id ); … … 311 311 }; 312 312 jQuery.each( defaultParams, function ( key, value ) { 313 ok( 'undefined' !== typeof section.params[ key ] );314 equal( value, section.params[ key ] );315 } ); 316 ok( _.isNumber( section.params.instanceNumber ) );313 assert.ok( 'undefined' !== typeof section.params[ key ] ); 314 assert.equal( value, section.params[ key ] ); 315 } ); 316 assert.ok( _.isNumber( section.params.instanceNumber ) ); 317 317 } ); 318 318 319 319 320 320 // Begin panels. 321 module( 'Customizer Panel in Fixture' );322 test( 'Fixture panel exists', function () {323 ok( wp.customize.panel.has( 'fixture-panel' ) );324 } ); 325 test( 'Fixture panel has content', function () {321 QUnit.module( 'Customizer Panel in Fixture' ); 322 QUnit.test( 'Fixture panel exists', function( assert ) { 323 assert.ok( wp.customize.panel.has( 'fixture-panel' ) ); 324 } ); 325 QUnit.test( 'Fixture panel has content', function( assert ) { 326 326 var panel = wp.customize.panel( 'fixture-panel' ); 327 ok( !! panel.params.content );328 ok( !! panel.container );329 ok( !! panel.headContainer );330 ok( !! panel.contentContainer );331 ok( panel.container.has( panel.headContainer ) );332 ok( panel.container.has( panel.contentContainer ) );333 } ); 334 test( 'Fixture panel has section among its sections()', function () {327 assert.ok( !! panel.params.content ); 328 assert.ok( !! panel.container ); 329 assert.ok( !! panel.headContainer ); 330 assert.ok( !! panel.contentContainer ); 331 assert.ok( panel.container.has( panel.headContainer ) ); 332 assert.ok( panel.container.has( panel.contentContainer ) ); 333 } ); 334 QUnit.test( 'Fixture panel has section among its sections()', function( assert ) { 335 335 var panel = wp.customize.panel( 'fixture-panel' ); 336 ok( -1 !== _.pluck( panel.sections(), 'id' ).indexOf( 'fixture-section' ) );337 } ); 338 test( 'Panel is not expanded by default', function () {336 assert.ok( -1 !== _.pluck( panel.sections(), 'id' ).indexOf( 'fixture-section' ) ); 337 } ); 338 QUnit.test( 'Panel is not expanded by default', function( assert ) { 339 339 var panel = wp.customize.panel( 'fixture-panel' ); 340 ok( ! panel.expanded() );341 } ); 342 test( 'Panel is not expanded by default', function () {340 assert.ok( ! panel.expanded() ); 341 } ); 342 QUnit.test( 'Panel is not expanded by default', function( assert ) { 343 343 var panel = wp.customize.panel( 'fixture-panel' ); 344 ok( ! panel.expanded() );345 } ); 346 test( 'Focusing on a control will expand the panel and section', function () {344 assert.ok( ! panel.expanded() ); 345 } ); 346 QUnit.test( 'Focusing on a control will expand the panel and section', function( assert ) { 347 347 var panel, section, control; 348 348 panel = wp.customize.panel( 'fixture-panel' ); 349 349 section = wp.customize.section( 'fixture-section' ); 350 350 control = wp.customize.control( 'fixture-control' ); 351 ok( ! panel.expanded() );352 ok( ! section.expanded() );351 assert.ok( ! panel.expanded() ); 352 assert.ok( ! section.expanded() ); 353 353 control.focus(); 354 ok( section.expanded() );355 ok( panel.expanded() );356 } ); 357 358 module( 'Customizer Default Panel with Template in Fixture' );359 test( 'Fixture section exists', function () {360 ok( wp.customize.panel.has( 'fixture-panel-default-templated' ) );361 } ); 362 test( 'Fixture panel has expected content', function () {354 assert.ok( section.expanded() ); 355 assert.ok( panel.expanded() ); 356 } ); 357 358 QUnit.module( 'Customizer Default Panel with Template in Fixture' ); 359 QUnit.test( 'Fixture section exists', function( assert ) { 360 assert.ok( wp.customize.panel.has( 'fixture-panel-default-templated' ) ); 361 } ); 362 QUnit.test( 'Fixture panel has expected content', function( assert ) { 363 363 var id = 'fixture-panel-default-templated', panel; 364 364 panel = wp.customize.panel( id ); 365 ok( ! panel.params.content );366 ok( !! panel.container );367 ok( !! panel.headContainer );368 ok( !! panel.contentContainer );369 ok( panel.container.has( panel.headContainer ) );370 ok( panel.container.has( panel.contentContainer ) );371 ok( panel.headContainer.is( '.control-panel.control-panel-default' ) );372 ok( 1 === panel.headContainer.find( '> .accordion-section-title' ).length );373 ok( panel.contentContainer.is( '.control-panel-content' ) );374 equal( panel.headContainer.attr( 'aria-owns' ), panel.contentContainer.attr( 'id' ) );375 } ); 376 377 module( 'Customizer Custom Type Panel (titleless) with Template in Fixture' );378 test( 'Fixture panel exists', function () {379 ok( wp.customize.panel.has( 'fixture-panel-titleless-templated' ) );380 } ); 381 test( 'Fixture panel has expected content', function () {365 assert.ok( ! panel.params.content ); 366 assert.ok( !! panel.container ); 367 assert.ok( !! panel.headContainer ); 368 assert.ok( !! panel.contentContainer ); 369 assert.ok( panel.container.has( panel.headContainer ) ); 370 assert.ok( panel.container.has( panel.contentContainer ) ); 371 assert.ok( panel.headContainer.is( '.control-panel.control-panel-default' ) ); 372 assert.ok( 1 === panel.headContainer.find( '> .accordion-section-title' ).length ); 373 assert.ok( panel.contentContainer.is( '.control-panel-content' ) ); 374 assert.equal( panel.headContainer.attr( 'aria-owns' ), panel.contentContainer.attr( 'id' ) ); 375 } ); 376 377 QUnit.module( 'Customizer Custom Type Panel (titleless) with Template in Fixture' ); 378 QUnit.test( 'Fixture panel exists', function( assert ) { 379 assert.ok( wp.customize.panel.has( 'fixture-panel-titleless-templated' ) ); 380 } ); 381 QUnit.test( 'Fixture panel has expected content', function( assert ) { 382 382 var id = 'fixture-panel-titleless-templated', panel; 383 383 panel = wp.customize.panel( id ); 384 ok( ! panel.params.content );385 ok( !! panel.container );386 ok( !! panel.headContainer );387 ok( !! panel.contentContainer );388 ok( panel.container.has( panel.headContainer ) );389 ok( panel.container.has( panel.contentContainer ) );390 ok( panel.headContainer.is( '.control-panel.control-panel-titleless' ) );391 ok( 0 === panel.headContainer.find( '> .accordion-section-title' ).length );392 ok( panel.contentContainer.is( '.control-panel-content' ) );393 equal( panel.headContainer.attr( 'aria-owns' ), panel.contentContainer.attr( 'id' ) );394 } ); 395 396 module( 'Customizer Custom Type Panel Lacking Specific Template' );397 test( 'Fixture panel has expected content', function () {384 assert.ok( ! panel.params.content ); 385 assert.ok( !! panel.container ); 386 assert.ok( !! panel.headContainer ); 387 assert.ok( !! panel.contentContainer ); 388 assert.ok( panel.container.has( panel.headContainer ) ); 389 assert.ok( panel.container.has( panel.contentContainer ) ); 390 assert.ok( panel.headContainer.is( '.control-panel.control-panel-titleless' ) ); 391 assert.ok( 0 === panel.headContainer.find( '> .accordion-section-title' ).length ); 392 assert.ok( panel.contentContainer.is( '.control-panel-content' ) ); 393 assert.equal( panel.headContainer.attr( 'aria-owns' ), panel.contentContainer.attr( 'id' ) ); 394 } ); 395 396 QUnit.module( 'Customizer Custom Type Panel Lacking Specific Template' ); 397 QUnit.test( 'Fixture panel has expected content', function( assert ) { 398 398 var id = 'fixture-panel-reusing-default-template', panel; 399 399 panel = wp.customize.panel( id ); 400 ok( ! panel.params.content );401 ok( !! panel.container );402 ok( !! panel.headContainer );403 ok( !! panel.contentContainer );404 ok( panel.container.has( panel.headContainer ) );405 ok( panel.container.has( panel.contentContainer ) );406 ok( panel.headContainer.is( '.control-panel.control-panel-' + panel.params.type ) );407 ok( 1 === panel.headContainer.find( '> .accordion-section-title' ).length );408 ok( panel.contentContainer.is( '.control-panel-content' ) );409 equal( panel.headContainer.attr( 'aria-owns' ), panel.contentContainer.attr( 'id' ) );410 } ); 411 module( 'Customizer Panel lacking any params' );412 test( 'Fixture panel has default params supplied', function () {400 assert.ok( ! panel.params.content ); 401 assert.ok( !! panel.container ); 402 assert.ok( !! panel.headContainer ); 403 assert.ok( !! panel.contentContainer ); 404 assert.ok( panel.container.has( panel.headContainer ) ); 405 assert.ok( panel.container.has( panel.contentContainer ) ); 406 assert.ok( panel.headContainer.is( '.control-panel.control-panel-' + panel.params.type ) ); 407 assert.ok( 1 === panel.headContainer.find( '> .accordion-section-title' ).length ); 408 assert.ok( panel.contentContainer.is( '.control-panel-content' ) ); 409 assert.equal( panel.headContainer.attr( 'aria-owns' ), panel.contentContainer.attr( 'id' ) ); 410 } ); 411 QUnit.module( 'Customizer Panel lacking any params' ); 412 QUnit.test( 'Fixture panel has default params supplied', function( assert ) { 413 413 var id = 'fixture-panel-without-params', panel, defaultParams; 414 414 panel = wp.customize.panel( id ); … … 422 422 }; 423 423 jQuery.each( defaultParams, function ( key, value ) { 424 ok( 'undefined' !== typeof panel.params[ key ] );425 equal( value, panel.params[ key ] );426 } ); 427 ok( _.isNumber( panel.params.instanceNumber ) );428 } ); 429 430 module( 'Dynamically-created Customizer Setting Model' );424 assert.ok( 'undefined' !== typeof panel.params[ key ] ); 425 assert.equal( value, panel.params[ key ] ); 426 } ); 427 assert.ok( _.isNumber( panel.params.instanceNumber ) ); 428 } ); 429 430 QUnit.module( 'Dynamically-created Customizer Setting Model' ); 431 431 settingId = 'new_blogname'; 432 432 settingValue = 'Hello World'; 433 433 434 test( 'Create a new setting', function () {434 QUnit.test( 'Create a new setting', function( assert ) { 435 435 mockSetting = wp.customize.create( 436 436 settingId, … … 442 442 } 443 443 ); 444 equal( mockSetting(), settingValue );445 equal( mockSetting.id, settingId );446 } ); 447 448 module( 'Dynamically-created Customizer Section Model' );444 assert.equal( mockSetting(), settingValue ); 445 assert.equal( mockSetting.id, settingId ); 446 } ); 447 448 QUnit.module( 'Dynamically-created Customizer Section Model' ); 449 449 450 450 sectionId = 'mock_title_tagline'; … … 468 468 testCustomizerModel( mockSection, sectionExpectedValues ); 469 469 470 test( 'Section has been embedded', function () {471 equal( mockSection.deferred.embedded.state(), 'resolved' );470 QUnit.test( 'Section has been embedded', function( assert ) { 471 assert.equal( mockSection.deferred.embedded.state(), 'resolved' ); 472 472 } ); 473 473 474 474 wp.customize.section.add( sectionId, mockSection ); 475 475 476 test( 'Section instance added to the wp.customize.section object', function () {477 ok( wp.customize.section.has( sectionId ) );476 QUnit.test( 'Section instance added to the wp.customize.section object', function( assert ) { 477 assert.ok( wp.customize.section.has( sectionId ) ); 478 478 }); 479 479 480 480 sectionInstance = wp.customize.section( sectionId ); 481 481 482 test( 'Section instance has right content when accessed from wp.customize.section()', function () {483 equal( sectionInstance.params.content, sectionContent );484 }); 485 486 test( 'Section instance has no children yet', function () {487 equal( sectionInstance.controls().length, 0 );488 }); 489 490 module( 'Dynamically-created Customizer Control Model' );482 QUnit.test( 'Section instance has right content when accessed from wp.customize.section()', function( assert ) { 483 assert.equal( sectionInstance.params.content, sectionContent ); 484 }); 485 486 QUnit.test( 'Section instance has no children yet', function( assert ) { 487 assert.equal( sectionInstance.controls().length, 0 ); 488 }); 489 490 QUnit.module( 'Dynamically-created Customizer Control Model' ); 491 491 492 492 controlId = 'new_blogname'; … … 521 521 testCustomizerModel( mockControl, controlExpectedValues ); 522 522 523 test( 'Control instance does not yet belong to a section.', function () {524 equal( mockControl.section(), undefined );525 }); 526 test( 'Control has not been embedded yet', function () {527 equal( mockControl.deferred.embedded.state(), 'pending' );528 } ); 529 530 test( 'Control instance has the right selector.', function () {531 equal( mockControl.selector, '#customize-control-new_blogname' );523 QUnit.test( 'Control instance does not yet belong to a section.', function( assert ) { 524 assert.equal( mockControl.section(), undefined ); 525 }); 526 QUnit.test( 'Control has not been embedded yet', function( assert ) { 527 assert.equal( mockControl.deferred.embedded.state(), 'pending' ); 528 } ); 529 530 QUnit.test( 'Control instance has the right selector.', function( assert ) { 531 assert.equal( mockControl.selector, '#customize-control-new_blogname' ); 532 532 }); 533 533 534 534 wp.customize.control.add( controlId, mockControl ); 535 535 536 test( 'Control instance was added to the control class.', function () {537 ok( wp.customize.control.has( controlId ) );536 QUnit.test( 'Control instance was added to the control class.', function( assert ) { 537 assert.ok( wp.customize.control.has( controlId ) ); 538 538 }); 539 539 540 540 mockControlInstance = wp.customize.control( controlId ); 541 541 542 test( 'Control instance has the right id when accessed from api.control().', function () {543 equal( mockControlInstance.id, controlId );544 }); 545 546 test( 'Control section can be set as expected', function () {542 QUnit.test( 'Control instance has the right id when accessed from api.control().', function( assert ) { 543 assert.equal( mockControlInstance.id, controlId ); 544 }); 545 546 QUnit.test( 'Control section can be set as expected', function( assert ) { 547 547 mockControl.section( mockSection.id ); 548 equal( mockControl.section(), mockSection.id );549 }); 550 test( 'Associating a control with a section allows it to be embedded', function () {551 equal( mockControl.deferred.embedded.state(), 'resolved' );552 }); 553 554 test( 'Control is now available on section.controls()', function () {555 equal( sectionInstance.controls().length, 1 );556 equal( sectionInstance.controls()[0], mockControl );557 }); 558 559 module( 'Dynamically-created Customizer Panel Model' );548 assert.equal( mockControl.section(), mockSection.id ); 549 }); 550 QUnit.test( 'Associating a control with a section allows it to be embedded', function( assert ) { 551 assert.equal( mockControl.deferred.embedded.state(), 'resolved' ); 552 }); 553 554 QUnit.test( 'Control is now available on section.controls()', function( assert ) { 555 assert.equal( sectionInstance.controls().length, 1 ); 556 assert.equal( sectionInstance.controls()[0], mockControl ); 557 }); 558 559 QUnit.module( 'Dynamically-created Customizer Panel Model' ); 560 560 561 561 panelId = 'mockPanelId'; … … 585 585 testCustomizerModel( mockPanel, panelExpectedValues ); 586 586 587 test( 'Panel instance is not contextuallyActive', function () {588 equal( mockPanel.isContextuallyActive(), false );589 }); 590 591 module( 'Test wp.customize.findControlsForSettings' );592 test( 'findControlsForSettings(blogname)', function() {587 QUnit.test( 'Panel instance is not contextuallyActive', function( assert ) { 588 assert.equal( mockPanel.isContextuallyActive(), false ); 589 }); 590 591 QUnit.module( 'Test wp.customize.findControlsForSettings' ); 592 QUnit.test( 'findControlsForSettings(blogname)', function( assert ) { 593 593 var controlsForSettings, settingId = 'fixture-setting', controlId = 'fixture-control'; 594 ok( wp.customize.control.has( controlId ) );595 ok( wp.customize.has( settingId ) );594 assert.ok( wp.customize.control.has( controlId ) ); 595 assert.ok( wp.customize.has( settingId ) ); 596 596 controlsForSettings = wp.customize.findControlsForSettings( [ settingId ] ); 597 ok( _.isObject( controlsForSettings ), 'Response is object' );598 ok( _.isArray( controlsForSettings['fixture-setting'] ), 'Response has a fixture-setting array' );599 equal( 1, controlsForSettings['fixture-setting'].length );600 equal( wp.customize.control( controlId ), controlsForSettings['fixture-setting'][0] );601 } ); 602 603 module( 'Customize Controls wp.customize.dirtyValues' );604 test( 'dirtyValues() returns expected values', function() {597 assert.ok( _.isObject( controlsForSettings ), 'Response is object' ); 598 assert.ok( _.isArray( controlsForSettings['fixture-setting'] ), 'Response has a fixture-setting array' ); 599 assert.equal( 1, controlsForSettings['fixture-setting'].length ); 600 assert.equal( wp.customize.control( controlId ), controlsForSettings['fixture-setting'][0] ); 601 } ); 602 603 QUnit.module( 'Customize Controls wp.customize.dirtyValues' ); 604 QUnit.test( 'dirtyValues() returns expected values', function( assert ) { 605 605 wp.customize.state( 'changesetStatus' ).set( 'auto-draft' ); 606 606 wp.customize.each( function( setting ) { 607 607 setting._dirty = false; 608 608 } ); 609 ok( _.isEmpty( wp.customize.dirtyValues() ) );610 ok( _.isEmpty( wp.customize.dirtyValues( { unsaved: false } ) ) );609 assert.ok( _.isEmpty( wp.customize.dirtyValues() ) ); 610 assert.ok( _.isEmpty( wp.customize.dirtyValues( { unsaved: false } ) ) ); 611 611 612 612 wp.customize( 'fixture-setting' )._dirty = true; 613 ok( ! _.isEmpty( wp.customize.dirtyValues() ) );614 ok( _.isEmpty( wp.customize.dirtyValues( { unsaved: true } ) ) );613 assert.ok( ! _.isEmpty( wp.customize.dirtyValues() ) ); 614 assert.ok( _.isEmpty( wp.customize.dirtyValues( { unsaved: true } ) ) ); 615 615 616 616 wp.customize( 'fixture-setting' ).set( 'Modified' ); 617 ok( ! _.isEmpty( wp.customize.dirtyValues() ) );618 ok( ! _.isEmpty( wp.customize.dirtyValues( { unsaved: true } ) ) );619 equal( 'Modified', wp.customize.dirtyValues()['fixture-setting'] );617 assert.ok( ! _.isEmpty( wp.customize.dirtyValues() ) ); 618 assert.ok( ! _.isEmpty( wp.customize.dirtyValues( { unsaved: true } ) ) ); 619 assert.equal( 'Modified', wp.customize.dirtyValues()['fixture-setting'] ); 620 620 621 621 // When the changeset does not exist, all dirty settings are necessarily unsaved. 622 622 wp.customize.state( 'changesetStatus' ).set( '' ); 623 623 wp.customize( 'fixture-setting' )._dirty = true; 624 ok( ! _.isEmpty( wp.customize.dirtyValues() ) );625 ok( ! _.isEmpty( wp.customize.dirtyValues( { unsaved: true } ) ) );626 } ); 627 628 module( 'Customize Controls: wp.customize.requestChangesetUpdate()' );629 test( 'requestChangesetUpdate makes request and returns promise', function( assert ) {624 assert.ok( ! _.isEmpty( wp.customize.dirtyValues() ) ); 625 assert.ok( ! _.isEmpty( wp.customize.dirtyValues( { unsaved: true } ) ) ); 626 } ); 627 628 QUnit.module( 'Customize Controls: wp.customize.requestChangesetUpdate()' ); 629 QUnit.test( 'requestChangesetUpdate makes request and returns promise', function( assert ) { 630 630 var request, originalBeforeSetup = jQuery.ajaxSettings.beforeSend; 631 631 … … 678 678 } ); 679 679 680 module( 'Customize Utils: wp.customize.utils.getRemainingTime()' );681 test( 'utils.getRemainingTime calculates time correctly', function( assert ) {680 QUnit.module( 'Customize Utils: wp.customize.utils.getRemainingTime()' ); 681 QUnit.test( 'utils.getRemainingTime calculates time correctly', function( assert ) { 682 682 var datetime = '2599-08-06 12:12:13', timeRemaining, timeRemainingWithDateInstance, timeRemaingingWithTimestamp; 683 683 … … 693 693 }); 694 694 695 module( 'Customize Utils: wp.customize.utils.getCurrentTimestamp()' );696 test( 'utils.getCurrentTimestamp returns timestamp', function( assert ) {695 QUnit.module( 'Customize Utils: wp.customize.utils.getCurrentTimestamp()' ); 696 QUnit.test( 'utils.getCurrentTimestamp returns timestamp', function( assert ) { 697 697 var currentTimeStamp; 698 698 currentTimeStamp = wp.customize.utils.getCurrentTimestamp(); … … 700 700 }); 701 701 702 module( 'Customize Controls: wp.customize.DateTimeControl' );703 test( 'Test DateTimeControl creation and its methods', function( assert ) {702 QUnit.module( 'Customize Controls: wp.customize.DateTimeControl' ); 703 QUnit.test( 'Test DateTimeControl creation and its methods', function( assert ) { 704 704 var control, controlId = 'date_time', section, sectionId = 'fixture-section', 705 705 datetime = '2599-08-06 18:12:13', dateTimeArray, dateTimeArrayInampm, timeString, … … 865 865 }); 866 866 867 module( 'Customize Sections: wp.customize.OuterSection' );868 test( 'Test OuterSection', function( assert ) {867 QUnit.module( 'Customize Sections: wp.customize.OuterSection' ); 868 QUnit.test( 'Test OuterSection', function( assert ) { 869 869 var section, sectionId = 'test_outer_section', body = jQuery( 'body' ), 870 870 defaultSection, defaultSectionId = 'fixture-section'; … … 900 900 }); 901 901 902 module( 'Customize Controls: PreviewLinkControl' );903 test( 'Test PreviewLinkControl creation and its methods', function( assert ) {902 QUnit.module( 'Customize Controls: PreviewLinkControl' ); 903 QUnit.test( 'Test PreviewLinkControl creation and its methods', function( assert ) { 904 904 var section, sectionId = 'publish_settings', newLink; 905 905 -
trunk/tests/qunit/wp-admin/js/customize-header.js
r46586 r47512 2 2 3 3 jQuery( function() { 4 module('Custom Header: ChoiceList', {5 setup: function() {4 QUnit.module('Custom Header: ChoiceList', { 5 beforeEach: function() { 6 6 wp.customize.HeaderTool.currentHeader = new wp.customize.HeaderTool.ImageModel(); 7 7 this.apiStub = sinon.stub(wp.customize, 'get').returns('foo'); 8 8 this.choiceList = new wp.customize.HeaderTool.ChoiceList(); 9 9 }, 10 teardown: function() {10 afterEach: function() { 11 11 this.apiStub.restore(); 12 12 } 13 13 }); 14 14 15 test('should parse _wpCustomizeHeader.uploads into itself', function() {16 equal(this.choiceList.length, 4);15 QUnit.test('should parse _wpCustomizeHeader.uploads into itself', function( assert ) { 16 assert.equal(this.choiceList.length, 4); 17 17 }); 18 18 19 test('should sort by newest first', function() {20 equal(this.choiceList.at(2).get('header').attachment_id, 1);21 equal(this.choiceList.first().get('header').attachment_id, 3);19 QUnit.test('should sort by newest first', function( assert ) { 20 assert.equal(this.choiceList.at(2).get('header').attachment_id, 1); 21 assert.equal(this.choiceList.first().get('header').attachment_id, 3); 22 22 }); 23 23 24 module('Custom Header: DefaultsList', {25 setup: function() {24 QUnit.module('Custom Header: DefaultsList', { 25 beforeEach: function() { 26 26 wp.customize.HeaderTool.currentHeader = new wp.customize.HeaderTool.ImageModel(); 27 27 this.apiStub = sinon.stub(wp.customize, 'get').returns('foo'); 28 28 this.choiceList = new wp.customize.HeaderTool.DefaultsList(); 29 29 }, 30 teardown: function() {30 afterEach: function() { 31 31 this.apiStub.restore(); 32 32 } 33 33 }); 34 34 35 test('it should parse _wpCustomizeHeader.defaults into itself', function() {36 equal(this.choiceList.length, 4);35 QUnit.test('it should parse _wpCustomizeHeader.defaults into itself', function( assert ) { 36 assert.equal(this.choiceList.length, 4); 37 37 }); 38 38 39 test('it parses the default image names', function() {40 equal(this.choiceList.first().get('header').defaultName, 'circle');41 equal(this.choiceList.at(2).get('header').defaultName, 'star');39 QUnit.test('it parses the default image names', function( assert ) { 40 assert.equal(this.choiceList.first().get('header').defaultName, 'circle'); 41 assert.equal(this.choiceList.at(2).get('header').defaultName, 'star'); 42 42 }); 43 43 44 module('Custom Header: HeaderImage shouldBeCropped()', {45 setup: function() {44 QUnit.module('Custom Header: HeaderImage shouldBeCropped()', { 45 beforeEach: function() { 46 46 wp.customize.HeaderTool.currentHeader = new wp.customize.HeaderTool.ImageModel(); 47 47 this.model = new wp.customize.HeaderTool.ImageModel(); … … 53 53 }); 54 54 55 test('should not be cropped when the theme does not support flex width or height and the image has the same dimensions of the theme image', function() {55 QUnit.test('should not be cropped when the theme does not support flex width or height and the image has the same dimensions of the theme image', function( assert ) { 56 56 this.model.set({ 57 57 themeFlexWidth: false, … … 61 61 }); 62 62 63 equal(this.model.shouldBeCropped(), false);63 assert.equal(this.model.shouldBeCropped(), false); 64 64 }); 65 65 66 test('should be cropped when the image has the same dimensions of the theme image', function() {66 QUnit.test('should be cropped when the image has the same dimensions of the theme image', function( assert ) { 67 67 this.model.set({ 68 68 themeFlexWidth: false, … … 72 72 }); 73 73 74 equal(this.model.shouldBeCropped(), true);74 assert.equal(this.model.shouldBeCropped(), true); 75 75 }); 76 76 77 test('should not be cropped when the theme only supports flex width and the image has the same height as the theme image', function() {77 QUnit.test('should not be cropped when the theme only supports flex width and the image has the same height as the theme image', function( assert ) { 78 78 this.model.set({ 79 79 themeFlexWidth: true, … … 83 83 }); 84 84 85 equal(this.model.shouldBeCropped(), false);85 assert.equal(this.model.shouldBeCropped(), false); 86 86 }); 87 87 88 test('should not be cropped when the theme only supports flex height and the image has the same width as the theme image', function() {88 QUnit.test('should not be cropped when the theme only supports flex height and the image has the same width as the theme image', function( assert ) { 89 89 this.model.set({ 90 90 themeFlexWidth: false, … … 94 94 }); 95 95 96 equal(this.model.shouldBeCropped(), false);96 assert.equal(this.model.shouldBeCropped(), false); 97 97 }); 98 98 99 test('should not be cropped when the theme supports flex height AND width', function() {99 QUnit.test('should not be cropped when the theme supports flex height AND width', function( assert ) { 100 100 this.model.set({ 101 101 themeFlexWidth: true, … … 105 105 }); 106 106 107 equal(this.model.shouldBeCropped(), false);107 assert.equal(this.model.shouldBeCropped(), false); 108 108 }); 109 109 110 test('should not be cropped when the image width is smaller than or equal to theme width', function() {110 QUnit.test('should not be cropped when the image width is smaller than or equal to theme width', function( assert ) { 111 111 this.model.set({ 112 112 themeFlexWidth: false, … … 116 116 }); 117 117 118 equal(this.model.shouldBeCropped(), false);118 assert.equal(this.model.shouldBeCropped(), false); 119 119 }); 120 120 121 test('should not be cropped when the image width is smaller than or equal to theme width, theme supports flex height and width', function() {121 QUnit.test('should not be cropped when the image width is smaller than or equal to theme width, theme supports flex height and width', function( assert ) { 122 122 this.model.set({ 123 123 themeFlexWidth: true, … … 127 127 }); 128 128 129 equal(this.model.shouldBeCropped(), false);129 assert.equal(this.model.shouldBeCropped(), false); 130 130 }); 131 131 }); -
trunk/tests/qunit/wp-admin/js/customize-nav-menus.js
r47122 r47512 1 1 /* global wp */ 2 jQuery( window ).load( function (){2 jQuery( window ).load( function() { 3 3 4 4 var api = wp.customize, … … 6 6 socialMenuId = 2; 7 7 8 module( 'Customize Nav Menus' );8 QUnit.module( 'Customize Nav Menus' ); 9 9 10 10 /** 11 11 * Generate 20 IDs and verify they are all unique. 12 12 */ 13 test( 'generatePlaceholderAutoIncrementId generates unique IDs', function() {13 QUnit.test( 'generatePlaceholderAutoIncrementId generates unique IDs', function( assert ) { 14 14 var testIterations = 20, 15 15 ids = [ api.Menus.generatePlaceholderAutoIncrementId() ]; … … 18 18 var placeholderID = api.Menus.generatePlaceholderAutoIncrementId(); 19 19 20 ok( -1 === ids.indexOf( placeholderID ) );20 assert.ok( -1 === ids.indexOf( placeholderID ) ); 21 21 ids.push( placeholderID ); 22 22 testIterations -= 1; … … 25 25 } ); 26 26 27 test( 'it should parse _wpCustomizeMenusSettings.defaults into itself', function() {28 deepEqual( window._wpCustomizeNavMenusSettings, api.Menus.data );27 QUnit.test( 'it should parse _wpCustomizeMenusSettings.defaults into itself', function( assert ) { 28 assert.deepEqual( window._wpCustomizeNavMenusSettings, api.Menus.data ); 29 29 } ); 30 30 31 test( 'empty menus should have no Menu Item Controls', function() {32 ok( 0 === wp.customize.Menus.getMenuControl( socialMenuId ).getMenuItemControls().length, 'empty menus' );31 QUnit.test( 'empty menus should have no Menu Item Controls', function( assert ) { 32 assert.ok( 0 === wp.customize.Menus.getMenuControl( socialMenuId ).getMenuItemControls().length, 'empty menus' ); 33 33 } ); 34 34 35 test( 'populated menus should have no Menu Item Controls', function() {36 ok( 0 !== wp.customize.Menus.getMenuControl( primaryMenuId ).getMenuItemControls().length, 'non-empty menus' );35 QUnit.test( 'populated menus should have no Menu Item Controls', function( assert ) { 36 assert.ok( 0 !== wp.customize.Menus.getMenuControl( primaryMenuId ).getMenuItemControls().length, 'non-empty menus' ); 37 37 } ); 38 38 … … 40 40 // (and api.Menus.AvailableItemCollection, api.Menus.AvailableItemModel). 41 41 42 test( 'there is a properly configured MenusPanel', function() {42 QUnit.test( 'there is a properly configured MenusPanel', function( assert ) { 43 43 var panel, sections; 44 44 45 45 panel = api.panel( 'nav_menus' ); 46 ok( panel );47 ok( panel.extended( api.Menus.MenusPanel ) );46 assert.ok( panel ); 47 assert.ok( panel.extended( api.Menus.MenusPanel ) ); 48 48 49 49 sections = panel.sections(); 50 ok( 'menu_locations' === sections[0].id, 'first section is menu_locations' );51 ok( sections[1].extended( api.Menus.MenuSection ), 'second section is MenuSection' );52 ok( sections[ sections.length - 1 ].extended( api.Menus.NewMenuSection ), 'last section is NewMenuSection' );50 assert.ok( 'menu_locations' === sections[0].id, 'first section is menu_locations' ); 51 assert.ok( sections[1].extended( api.Menus.MenuSection ), 'second section is MenuSection' ); 52 assert.ok( sections[ sections.length - 1 ].extended( api.Menus.NewMenuSection ), 'last section is NewMenuSection' ); 53 53 } ); 54 54 // @todo Add more tests for api.Menus.MenusPanel behaviors. 55 55 56 test( 'there an expected MenuSection for the primary menu', function() {56 QUnit.test( 'there an expected MenuSection for the primary menu', function( assert ) { 57 57 var section, controls, lastControl; 58 58 59 59 section = api.section( 'nav_menu[' + primaryMenuId + ']' ); 60 ok( section, 'section exists' );61 ok( section.extended( api.Menus.MenuSection ), 'section is a api.Menus.MenuSection' );62 ok( section.deferred.initSortables, 'has section.deferred.initSortables' );63 ok( section.active(), 'section active() is true' );64 ok( section.active.set( false ).get(), 'section active() cannot be set false' );60 assert.ok( section, 'section exists' ); 61 assert.ok( section.extended( api.Menus.MenuSection ), 'section is a api.Menus.MenuSection' ); 62 assert.ok( section.deferred.initSortables, 'has section.deferred.initSortables' ); 63 assert.ok( section.active(), 'section active() is true' ); 64 assert.ok( section.active.set( false ).get(), 'section active() cannot be set false' ); 65 65 66 66 controls = section.controls(); 67 ok( controls[0].extended( api.Menus.MenuNameControl ), 'first control in menu section is MenuNameControl' );68 ok( controls[1].extended( api.Menus.MenuItemControl ), 'second control in menu section is MenuItemControl' );67 assert.ok( controls[0].extended( api.Menus.MenuNameControl ), 'first control in menu section is MenuNameControl' ); 68 assert.ok( controls[1].extended( api.Menus.MenuItemControl ), 'second control in menu section is MenuItemControl' ); 69 69 70 70 lastControl = controls[ controls.length - 1 ]; 71 ok( lastControl.extended( api.Control ), 'last control in menu section is a base Control' );72 ok( lastControl.params.templateId === 'nav-menu-delete-button', 'last control in menu section has a delete-button template' );71 assert.ok( lastControl.extended( api.Control ), 'last control in menu section is a base Control' ); 72 assert.ok( lastControl.params.templateId === 'nav-menu-delete-button', 'last control in menu section has a delete-button template' ); 73 73 } ); 74 74 // @todo Add more tests for api.Menus.MenuSection behaviors. 75 75 76 test( 'changing a MenuNameControl change the corresponding menu value', function() {76 QUnit.test( 'changing a MenuNameControl change the corresponding menu value', function( assert ) { 77 77 var section, control; 78 78 79 79 section = api.section( 'nav_menu[' + primaryMenuId + ']' ); 80 80 control = section.controls()[0]; 81 ok( control.extended( api.Menus.MenuNameControl ), 'control is a MenuNameControl' );82 equal( control.setting().name, 'Primary menu' );83 ok( ! control.setting._dirty );81 assert.ok( control.extended( api.Menus.MenuNameControl ), 'control is a MenuNameControl' ); 82 assert.equal( control.setting().name, 'Primary menu' ); 83 assert.ok( ! control.setting._dirty ); 84 84 control.container.find( 'input[type=text]:first' ).val( 'Main menu' ).trigger( 'change' ); 85 equal( control.setting().name, 'Main menu' );86 ok( control.setting._dirty );85 assert.equal( control.setting().name, 'Main menu' ); 86 assert.ok( control.setting._dirty ); 87 87 } ); 88 88 // @todo Add more tests for api.Menus.MenuNameControl 89 89 90 test( 'manipulating a MenuItemControl works', function() {90 QUnit.test( 'manipulating a MenuItemControl works', function( assert ) { 91 91 var section, control, value; 92 92 section = api.section( 'nav_menu[' + primaryMenuId + ']' ); 93 ok( section );93 assert.ok( section ); 94 94 95 95 control = section.controls()[1]; 96 ok( control.extended( api.Menus.MenuItemControl ), 'control is a MenuItemControl' );96 assert.ok( control.extended( api.Menus.MenuItemControl ), 'control is a MenuItemControl' ); 97 97 98 98 control.actuallyEmbed(); 99 99 100 100 control.container.find( '.edit-menu-item-title' ).val( 'Hello World' ).trigger( 'change' ); 101 equal( control.setting().title, 'Hello World' );101 assert.equal( control.setting().title, 'Hello World' ); 102 102 value = _.clone( control.setting() ); 103 103 value.title = 'Hola Mundo'; 104 equal( control.container.find( '.edit-menu-item-title' ).val(), 'Hello World' );105 equal( value.position, 1 );106 equal( control.priority(), 1 );104 assert.equal( control.container.find( '.edit-menu-item-title' ).val(), 'Hello World' ); 105 assert.equal( value.position, 1 ); 106 assert.equal( control.priority(), 1 ); 107 107 108 108 // @todo Test control.moveDown(). … … 119 119 // @todo Add tests for api.Menus.createNavMenu. 120 120 121 test( 'api.Menus.getMenuControl() should return the expected control', function() {121 QUnit.test( 'api.Menus.getMenuControl() should return the expected control', function( assert ) { 122 122 var control = api.Menus.getMenuControl( primaryMenuId ); 123 ok( !! control, 'control is returned' );124 ok( control.extended( api.Menus.MenuControl ), 'control is a MenuControl' );123 assert.ok( !! control, 'control is returned' ); 124 assert.ok( control.extended( api.Menus.MenuControl ), 'control is a MenuControl' ); 125 125 } ); 126 126 127 test( 'api.Menus.getMenuItemControl() should return the expected control', function() {127 QUnit.test( 'api.Menus.getMenuItemControl() should return the expected control', function( assert ) { 128 128 var control = api.Menus.getMenuItemControl( 2000 ); 129 ok( !! control, 'control is returned' );130 ok( control.extended( api.Menus.MenuItemControl ), 'control is a MenuItemControl' );129 assert.ok( !! control, 'control is returned' ); 130 assert.ok( control.extended( api.Menus.MenuItemControl ), 'control is a MenuItemControl' ); 131 131 } ); 132 132 -
trunk/tests/qunit/wp-admin/js/customize-widgets.js
r46586 r47512 4 4 var api = wp.customize, $ = jQuery; 5 5 6 module( 'Customize Widgets' );6 QUnit.module( 'Customize Widgets' ); 7 7 8 test( 'fixtures should be present', function() {8 QUnit.test( 'fixtures should be present', function( assert ) { 9 9 var widgetControl; 10 ok( api.panel( 'widgets' ) );11 ok( api.section( 'sidebar-widgets-sidebar-1' ) );10 assert.ok( api.panel( 'widgets' ) ); 11 assert.ok( api.section( 'sidebar-widgets-sidebar-1' ) ); 12 12 widgetControl = api.control( 'widget_search[2]' ); 13 ok( widgetControl );14 ok( api.control( 'sidebars_widgets[sidebar-1]' ) );15 ok( api( 'widget_search[2]' ) );16 ok( api( 'sidebars_widgets[sidebar-1]' ) );17 ok( widgetControl.params.content );18 ok( widgetControl.params.widget_control );19 ok( widgetControl.params.widget_content );20 ok( widgetControl.params.widget_id );21 ok( widgetControl.params.widget_id_base );13 assert.ok( widgetControl ); 14 assert.ok( api.control( 'sidebars_widgets[sidebar-1]' ) ); 15 assert.ok( api( 'widget_search[2]' ) ); 16 assert.ok( api( 'sidebars_widgets[sidebar-1]' ) ); 17 assert.ok( widgetControl.params.content ); 18 assert.ok( widgetControl.params.widget_control ); 19 assert.ok( widgetControl.params.widget_content ); 20 assert.ok( widgetControl.params.widget_id ); 21 assert.ok( widgetControl.params.widget_id_base ); 22 22 }); 23 23 24 test( 'widget contents should embed (with widget-added event) when section and control expand', function() {24 QUnit.test( 'widget contents should embed (with widget-added event) when section and control expand', function( assert ) { 25 25 var control, section, widgetAddedEvent = null, widgetControlRootElement = null; 26 26 control = api.control( 'widget_search[2]' ); … … 32 32 }); 33 33 34 ok( ! section.expanded() );35 ok( 0 === control.container.find( '> .widget' ).length );34 assert.ok( ! section.expanded() ); 35 assert.ok( 0 === control.container.find( '> .widget' ).length ); 36 36 37 37 // Preview sets the active state. … … 41 41 42 42 section.expand(); 43 ok( ! widgetAddedEvent, 'expected widget added event not fired' );44 ok( 1 === control.container.find( '> .widget' ).length, 'expected there to be one .widget element in the container' );45 ok( 0 === control.container.find( '.widget-content' ).children().length );43 assert.ok( ! widgetAddedEvent, 'expected widget added event not fired' ); 44 assert.ok( 1 === control.container.find( '> .widget' ).length, 'expected there to be one .widget element in the container' ); 45 assert.ok( 0 === control.container.find( '.widget-content' ).children().length ); 46 46 47 47 control.expand(); 48 ok( 1 === control.container.find( '.widget-content' ).children().length );49 ok( widgetAddedEvent );50 ok( widgetControlRootElement.is( control.container.find( '> .widget' ) ) );51 ok( 1 === control.container.find( '.widget-content #widget-search-2-title' ).length );48 assert.ok( 1 === control.container.find( '.widget-content' ).children().length ); 49 assert.ok( widgetAddedEvent ); 50 assert.ok( widgetControlRootElement.is( control.container.find( '> .widget' ) ) ); 51 assert.ok( 1 === control.container.find( '.widget-content #widget-search-2-title' ).length ); 52 52 53 53 $( document ).off( 'widget-added' ); 54 54 }); 55 55 56 test( 'widgets panel should have notice', function() {56 QUnit.test( 'widgets panel should have notice', function( assert ) { 57 57 var panel = api.panel( 'widgets' ); 58 ok( panel.extended( api.Widgets.WidgetsPanel ) );58 assert.ok( panel.extended( api.Widgets.WidgetsPanel ) ); 59 59 60 60 panel.deferred.embedded.done( function() { 61 ok( 1 === panel.contentContainer.find( '.no-widget-areas-rendered-notice' ).length );62 ok( panel.contentContainer.find( '.no-widget-areas-rendered-notice' ).is( ':visible' ) );61 assert.ok( 1 === panel.contentContainer.find( '.no-widget-areas-rendered-notice' ).length ); 62 assert.ok( panel.contentContainer.find( '.no-widget-areas-rendered-notice' ).is( ':visible' ) ); 63 63 api.section( 'sidebar-widgets-sidebar-1' ).active( true ); 64 64 api.control( 'sidebars_widgets[sidebar-1]' ).active( true ); 65 65 api.trigger( 'pane-contents-reflowed' ); 66 ok( ! panel.contentContainer.find( '.no-widget-areas-rendered-notice' ).is( ':visible' ) );66 assert.ok( ! panel.contentContainer.find( '.no-widget-areas-rendered-notice' ).is( ':visible' ) ); 67 67 } ); 68 68 69 expect( 4 );69 assert.expect( 4 ); 70 70 }); 71 71 }); -
trunk/tests/qunit/wp-admin/js/nav-menu.js
r46586 r47512 7 7 8 8 // Fail if we don't see the expected number of events triggered in 3 seconds. 9 setTimeout( function( ) {9 setTimeout( function( assert ) { 10 10 // QUnit may load this file without running it, in which case `assert` 11 11 // will never be set to `assertPassed` below. -
trunk/tests/qunit/wp-admin/js/password-strength-meter.js
r47122 r47512 1 1 /* global passwordStrength, wp, jQuery */ 2 2 jQuery( function() { 3 module( 'password-strength-meter' );3 QUnit.module( 'password-strength-meter' ); 4 4 5 test( 'mismatched passwords should return 5', function() {6 equal( passwordStrength( 'password1', 'username', 'password2' ), 5, 'mismatched passwords return 5' );5 QUnit.test( 'mismatched passwords should return 5', function( assert ) { 6 assert.equal( passwordStrength( 'password1', 'username', 'password2' ), 5, 'mismatched passwords return 5' ); 7 7 }); 8 8 9 test( 'passwords shorter than 4 characters should return 0', function() {10 equal( passwordStrength( 'abc', 'username', 'abc' ), 0, 'short passwords return 0' );9 QUnit.test( 'passwords shorter than 4 characters should return 0', function( assert ) { 10 assert.equal( passwordStrength( 'abc', 'username', 'abc' ), 0, 'short passwords return 0' ); 11 11 }); 12 12 13 test( 'long complicated passwords should return 4', function() {13 QUnit.test( 'long complicated passwords should return 4', function( assert ) { 14 14 var password = function( length ) { 15 15 var i, n, retVal = '', … … 22 22 twofifty = password( 250 ); 23 23 24 equal( passwordStrength( twofifty, 'username', twofifty ), 4, '250 character complicated password returns 4' );24 assert.equal( passwordStrength( twofifty, 'username', twofifty ), 4, '250 character complicated password returns 4' ); 25 25 }); 26 26 27 test( 'short uncomplicated passwords should return 0', function() {27 QUnit.test( 'short uncomplicated passwords should return 0', function( assert ) { 28 28 var letters = 'aaaa', 29 29 numbers = '1111', 30 30 password = 'password', 31 31 uppercase = 'AAAA'; 32 equal( passwordStrength( letters, 'username', letters ), 0, 'password of `' + letters + '` returns 0' );33 equal( passwordStrength( numbers, 'username', numbers ), 0, 'password of `' + numbers + '` returns 0' );34 equal( passwordStrength( uppercase, 'username', uppercase ), 0, 'password of `' + uppercase + '` returns 0' );35 equal( passwordStrength( password, 'username', password ), 0, 'password of `' + password + '` returns 0' );32 assert.equal( passwordStrength( letters, 'username', letters ), 0, 'password of `' + letters + '` returns 0' ); 33 assert.equal( passwordStrength( numbers, 'username', numbers ), 0, 'password of `' + numbers + '` returns 0' ); 34 assert.equal( passwordStrength( uppercase, 'username', uppercase ), 0, 'password of `' + uppercase + '` returns 0' ); 35 assert.equal( passwordStrength( password, 'username', password ), 0, 'password of `' + password + '` returns 0' ); 36 36 }); 37 37 38 test( 'zxcvbn password tests should return the score we expect', function() {38 QUnit.test( 'zxcvbn password tests should return the score we expect', function( assert ) { 39 39 var passwords, i; 40 40 passwords = [ … … 77 77 78 78 for ( i = 0; i < passwords.length; i++ ) { 79 equal( passwordStrength( passwords[i].pw, 'username', passwords[i].pw ), passwords[i].score, 'password of `' + passwords[i].pw + '` returns ' + passwords[i].score );79 assert.equal( passwordStrength( passwords[i].pw, 'username', passwords[i].pw ), passwords[i].score, 'password of `' + passwords[i].pw + '` returns ' + passwords[i].score ); 80 80 } 81 81 }); 82 82 83 test( 'blacklisted words in password should be penalized', function() {83 QUnit.test( 'blacklisted words in password should be penalized', function( assert ) { 84 84 var allowedPasswordScore, penalizedPasswordScore, 85 85 allowedPassword = 'a[janedoefoe]4', … … 90 90 penalizedPasswordScore = passwordStrength( penalizedPassword, blacklist, penalizedPassword ); 91 91 92 ok( penalizedPasswordScore < allowedPasswordScore, 'Penalized password scored ' + penalizedPasswordScore + '; allowed password scored: ' + allowedPasswordScore );92 assert.ok( penalizedPasswordScore < allowedPasswordScore, 'Penalized password scored ' + penalizedPasswordScore + '; allowed password scored: ' + allowedPasswordScore ); 93 93 }); 94 94 95 test( 'user input blacklist array should contain expected words', function() {95 QUnit.test( 'user input blacklist array should contain expected words', function( assert ) { 96 96 var blacklist = wp.passwordStrength.userInputBlacklist(); 97 97 98 ok( jQuery.isArray( blacklist ), 'blacklist is an array' );99 ok( jQuery.inArray( 'WordPress', blacklist ) > -1, 'blacklist contains "WordPress" from page title' );100 ok( jQuery.inArray( 'tests', blacklist ) > -1, 'blacklist contains "tests" from site URL' );98 assert.ok( jQuery.isArray( blacklist ), 'blacklist is an array' ); 99 assert.ok( jQuery.inArray( 'WordPress', blacklist ) > -1, 'blacklist contains "WordPress" from page title' ); 100 assert.ok( jQuery.inArray( 'tests', blacklist ) > -1, 'blacklist contains "tests" from site URL' ); 101 101 }); 102 102 }); -
trunk/tests/qunit/wp-admin/js/widgets/test-media-gallery-widget.js
r46586 r47512 7 7 'use strict'; 8 8 9 module( 'Gallery Media Widget' );9 QUnit.module( 'Gallery Media Widget' ); 10 10 11 test( 'gallery widget control', function() {11 QUnit.test( 'gallery widget control', function( assert ) { 12 12 var GalleryWidgetControl; 13 equal( typeof wp.mediaWidgets.controlConstructors.media_gallery, 'function', 'wp.mediaWidgets.controlConstructors.media_gallery is a function' );13 assert.equal( typeof wp.mediaWidgets.controlConstructors.media_gallery, 'function', 'wp.mediaWidgets.controlConstructors.media_gallery is a function' ); 14 14 GalleryWidgetControl = wp.mediaWidgets.controlConstructors.media_gallery; 15 ok( GalleryWidgetControl.prototype instanceof wp.mediaWidgets.MediaWidgetControl, 'wp.mediaWidgets.controlConstructors.media_gallery subclasses wp.mediaWidgets.MediaWidgetControl' );15 assert.ok( GalleryWidgetControl.prototype instanceof wp.mediaWidgets.MediaWidgetControl, 'wp.mediaWidgets.controlConstructors.media_gallery subclasses wp.mediaWidgets.MediaWidgetControl' ); 16 16 }); 17 17 18 test( 'gallery media model', function() {18 QUnit.test( 'gallery media model', function( assert ) { 19 19 var GalleryWidgetModel, galleryWidgetModelInstance; 20 equal( typeof wp.mediaWidgets.modelConstructors.media_gallery, 'function', 'wp.mediaWidgets.modelConstructors.media_gallery is a function' );20 assert.equal( typeof wp.mediaWidgets.modelConstructors.media_gallery, 'function', 'wp.mediaWidgets.modelConstructors.media_gallery is a function' ); 21 21 GalleryWidgetModel = wp.mediaWidgets.modelConstructors.media_gallery; 22 ok( GalleryWidgetModel.prototype instanceof wp.mediaWidgets.MediaWidgetModel, 'wp.mediaWidgets.modelConstructors.media_gallery subclasses wp.mediaWidgets.MediaWidgetModel' );22 assert.ok( GalleryWidgetModel.prototype instanceof wp.mediaWidgets.MediaWidgetModel, 'wp.mediaWidgets.modelConstructors.media_gallery subclasses wp.mediaWidgets.MediaWidgetModel' ); 23 23 24 24 galleryWidgetModelInstance = new GalleryWidgetModel(); 25 25 _.each( galleryWidgetModelInstance.attributes, function( value, key ) { 26 equal( value, GalleryWidgetModel.prototype.schema[ key ][ 'default' ], 'Should properly set default for ' + key );26 assert.equal( value, GalleryWidgetModel.prototype.schema[ key ][ 'default' ], 'Should properly set default for ' + key ); 27 27 }); 28 28 }); -
trunk/tests/qunit/wp-admin/js/widgets/test-media-image-widget.js
r47122 r47512 7 7 'use strict'; 8 8 9 module( 'Image Media Widget' );9 QUnit.module( 'Image Media Widget' ); 10 10 11 test( 'image widget control', function() {11 QUnit.test( 'image widget control', function( assert ) { 12 12 var ImageWidgetControl, imageWidgetControlInstance, imageWidgetModelInstance, mappedProps, testImageUrl, templateProps; 13 13 testImageUrl = 'http://s.w.org/style/images/wp-header-logo.png'; 14 equal( typeof wp.mediaWidgets.controlConstructors.media_image, 'function', 'wp.mediaWidgets.controlConstructors.media_image is a function' );14 assert.equal( typeof wp.mediaWidgets.controlConstructors.media_image, 'function', 'wp.mediaWidgets.controlConstructors.media_image is a function' ); 15 15 ImageWidgetControl = wp.mediaWidgets.controlConstructors.media_image; 16 ok( ImageWidgetControl.prototype instanceof wp.mediaWidgets.MediaWidgetControl, 'wp.mediaWidgets.controlConstructors.media_image subclasses wp.mediaWidgets.MediaWidgetControl' );16 assert.ok( ImageWidgetControl.prototype instanceof wp.mediaWidgets.MediaWidgetControl, 'wp.mediaWidgets.controlConstructors.media_image subclasses wp.mediaWidgets.MediaWidgetControl' ); 17 17 18 18 imageWidgetModelInstance = new wp.mediaWidgets.modelConstructors.media_image(); … … 25 25 // Test mapModelToPreviewTemplateProps() when no data is set. 26 26 templateProps = imageWidgetControlInstance.mapModelToPreviewTemplateProps(); 27 equal( templateProps.caption, undefined, 'mapModelToPreviewTemplateProps should not return attributes that are should_preview_update false' );28 equal( templateProps.attachment_id, 0, 'mapModelToPreviewTemplateProps should return default values' );29 equal( templateProps.currentFilename, '', 'mapModelToPreviewTemplateProps should return a currentFilename' );27 assert.equal( templateProps.caption, undefined, 'mapModelToPreviewTemplateProps should not return attributes that are should_preview_update false' ); 28 assert.equal( templateProps.attachment_id, 0, 'mapModelToPreviewTemplateProps should return default values' ); 29 assert.equal( templateProps.currentFilename, '', 'mapModelToPreviewTemplateProps should return a currentFilename' ); 30 30 31 31 // Test mapModelToPreviewTemplateProps() when data is set on model. 32 32 imageWidgetControlInstance.model.set( { url: testImageUrl, alt: 'some alt text', link_type: 'none' } ); 33 33 templateProps = imageWidgetControlInstance.mapModelToPreviewTemplateProps(); 34 equal( templateProps.currentFilename, 'wp-header-logo.png', 'mapModelToPreviewTemplateProps should set currentFilename based off of url' );35 equal( templateProps.url, testImageUrl, 'mapModelToPreviewTemplateProps should return the proper url' );36 equal( templateProps.alt, 'some alt text', 'mapModelToPreviewTemplateProps should return the proper alt text' );37 equal( templateProps.link_type, undefined, 'mapModelToPreviewTemplateProps should ignore attributes that are not needed in the preview' );38 equal( templateProps.error, false, 'mapModelToPreviewTemplateProps should return error state' );34 assert.equal( templateProps.currentFilename, 'wp-header-logo.png', 'mapModelToPreviewTemplateProps should set currentFilename based off of url' ); 35 assert.equal( templateProps.url, testImageUrl, 'mapModelToPreviewTemplateProps should return the proper url' ); 36 assert.equal( templateProps.alt, 'some alt text', 'mapModelToPreviewTemplateProps should return the proper alt text' ); 37 assert.equal( templateProps.link_type, undefined, 'mapModelToPreviewTemplateProps should ignore attributes that are not needed in the preview' ); 38 assert.equal( templateProps.error, false, 'mapModelToPreviewTemplateProps should return error state' ); 39 39 40 40 // Test mapModelToPreviewTemplateProps() when error is set on model. 41 41 imageWidgetControlInstance.model.set( 'error', 'missing_attachment' ); 42 42 templateProps = imageWidgetControlInstance.mapModelToPreviewTemplateProps(); 43 equal( templateProps.error, 'missing_attachment', 'mapModelToPreviewTemplateProps should return error string' );43 assert.equal( templateProps.error, 'missing_attachment', 'mapModelToPreviewTemplateProps should return error string' ); 44 44 45 45 // Reset model. … … 47 47 48 48 // Test isSelected(). 49 equal( imageWidgetControlInstance.isSelected(), false, 'media_image.isSelected() should return false when no media is selected' );49 assert.equal( imageWidgetControlInstance.isSelected(), false, 'media_image.isSelected() should return false when no media is selected' ); 50 50 imageWidgetControlInstance.model.set({ error: 'missing_attachment', attachment_id: 777 }); 51 equal( imageWidgetControlInstance.isSelected(), false, 'media_image.isSelected() should return false when media is selected and error is set' );51 assert.equal( imageWidgetControlInstance.isSelected(), false, 'media_image.isSelected() should return false when media is selected and error is set' ); 52 52 imageWidgetControlInstance.model.set({ error: false, attachment_id: 777 }); 53 equal( imageWidgetControlInstance.isSelected(), true, 'media_image.isSelected() should return true when media is selected and no error exists' );53 assert.equal( imageWidgetControlInstance.isSelected(), true, 'media_image.isSelected() should return true when media is selected and no error exists' ); 54 54 imageWidgetControlInstance.model.set({ error: false, attachment_id: 0, url: testImageUrl }); 55 equal( imageWidgetControlInstance.isSelected(), true, 'media_image.isSelected() should return true when url is set and no error exists' );55 assert.equal( imageWidgetControlInstance.isSelected(), true, 'media_image.isSelected() should return true when url is set and no error exists' ); 56 56 57 57 // Reset model. … … 61 61 imageWidgetControlInstance.render(); 62 62 imageWidgetControlInstance.$el.find( '.title' ).val( 'Chicken and Ribs' ).trigger( 'input' ); 63 equal( imageWidgetModelInstance.get( 'title' ), 'Chicken and Ribs', 'Changing title should update model title attribute' );63 assert.equal( imageWidgetModelInstance.get( 'title' ), 'Chicken and Ribs', 'Changing title should update model title attribute' ); 64 64 65 65 // Test mapMediaToModelProps. 66 66 mappedProps = imageWidgetControlInstance.mapMediaToModelProps( { link: 'file', url: testImageUrl } ); 67 equal( mappedProps.link_url, testImageUrl, 'mapMediaToModelProps should set file link_url according to mediaFrameProps.link' );67 assert.equal( mappedProps.link_url, testImageUrl, 'mapMediaToModelProps should set file link_url according to mediaFrameProps.link' ); 68 68 mappedProps = imageWidgetControlInstance.mapMediaToModelProps( { link: 'post', postUrl: 'https://wordpress.org/image-2/' } ); 69 equal( mappedProps.link_url, 'https://wordpress.org/image-2/', 'mapMediaToModelProps should set file link_url according to mediaFrameProps.link' );69 assert.equal( mappedProps.link_url, 'https://wordpress.org/image-2/', 'mapMediaToModelProps should set file link_url according to mediaFrameProps.link' ); 70 70 mappedProps = imageWidgetControlInstance.mapMediaToModelProps( { link: 'custom', linkUrl: 'https://wordpress.org' } ); 71 equal( mappedProps.link_url, 'https://wordpress.org', 'mapMediaToModelProps should set custom link_url according to mediaFrameProps.linkUrl' );71 assert.equal( mappedProps.link_url, 'https://wordpress.org', 'mapMediaToModelProps should set custom link_url according to mediaFrameProps.linkUrl' ); 72 72 73 73 // Test mapModelToMediaFrameProps(). 74 74 imageWidgetControlInstance.model.set({ error: false, url: testImageUrl, 'link_type': 'custom', 'link_url': 'https://wordpress.org', 'size': 'custom', 'width': 100, 'height': 150, 'title': 'widget title', 'image_title': 'title of image' }); 75 75 mappedProps = imageWidgetControlInstance.mapModelToMediaFrameProps( imageWidgetControlInstance.model.toJSON() ); 76 equal( mappedProps.linkUrl, 'https://wordpress.org', 'mapModelToMediaFrameProps should set linkUrl from model.link_url' );77 equal( mappedProps.link, 'custom', 'mapModelToMediaFrameProps should set link from model.link_type' );78 equal( mappedProps.width, 100, 'mapModelToMediaFrameProps should set width when model.size is custom' );79 equal( mappedProps.height, 150, 'mapModelToMediaFrameProps should set height when model.size is custom' );80 equal( mappedProps.title, 'title of image', 'mapModelToMediaFrameProps should set title from model.image_title' );76 assert.equal( mappedProps.linkUrl, 'https://wordpress.org', 'mapModelToMediaFrameProps should set linkUrl from model.link_url' ); 77 assert.equal( mappedProps.link, 'custom', 'mapModelToMediaFrameProps should set link from model.link_type' ); 78 assert.equal( mappedProps.width, 100, 'mapModelToMediaFrameProps should set width when model.size is custom' ); 79 assert.equal( mappedProps.height, 150, 'mapModelToMediaFrameProps should set height when model.size is custom' ); 80 assert.equal( mappedProps.title, 'title of image', 'mapModelToMediaFrameProps should set title from model.image_title' ); 81 81 }); 82 82 83 test( 'image widget control renderPreview', function( assert ) {83 QUnit.test( 'image widget control renderPreview', function( assert ) { 84 84 var imageWidgetControlInstance, imageWidgetModelInstance, done; 85 85 done = assert.async(); … … 91 91 model: imageWidgetModelInstance 92 92 }); 93 equal( imageWidgetControlInstance.$el.find( 'img' ).length, 0, 'No images should be rendered' );93 assert.equal( imageWidgetControlInstance.$el.find( 'img' ).length, 0, 'No images should be rendered' ); 94 94 imageWidgetControlInstance.model.set({ error: false, url: 'http://s.w.org/style/images/wp-header-logo.png' }); 95 95 96 96 // Due to renderPreview being deferred. 97 97 setTimeout( function() { 98 equal( imageWidgetControlInstance.$el.find( 'img[src="http://s.w.org/style/images/wp-header-logo.png"]' ).length, 1, 'One image should be rendered' );98 assert.equal( imageWidgetControlInstance.$el.find( 'img[src="http://s.w.org/style/images/wp-header-logo.png"]' ).length, 1, 'One image should be rendered' ); 99 99 done(); 100 100 }, 50 ); 101 101 102 start();102 done(); 103 103 }); 104 104 105 test( 'image media model', function() {105 QUnit.test( 'image media model', function( assert ) { 106 106 var ImageWidgetModel, imageWidgetModelInstance; 107 equal( typeof wp.mediaWidgets.modelConstructors.media_image, 'function', 'wp.mediaWidgets.modelConstructors.media_image is a function' );107 assert.equal( typeof wp.mediaWidgets.modelConstructors.media_image, 'function', 'wp.mediaWidgets.modelConstructors.media_image is a function' ); 108 108 ImageWidgetModel = wp.mediaWidgets.modelConstructors.media_image; 109 ok( ImageWidgetModel.prototype instanceof wp.mediaWidgets.MediaWidgetModel, 'wp.mediaWidgets.modelConstructors.media_image subclasses wp.mediaWidgets.MediaWidgetModel' );109 assert.ok( ImageWidgetModel.prototype instanceof wp.mediaWidgets.MediaWidgetModel, 'wp.mediaWidgets.modelConstructors.media_image subclasses wp.mediaWidgets.MediaWidgetModel' ); 110 110 111 111 imageWidgetModelInstance = new ImageWidgetModel(); 112 112 _.each( imageWidgetModelInstance.attributes, function( value, key ) { 113 equal( value, ImageWidgetModel.prototype.schema[ key ][ 'default' ], 'Should properly set default for ' + key );113 assert.equal( value, ImageWidgetModel.prototype.schema[ key ][ 'default' ], 'Should properly set default for ' + key ); 114 114 }); 115 115 }); -
trunk/tests/qunit/wp-admin/js/widgets/test-media-video-widget.js
r46586 r47512 7 7 'use strict'; 8 8 9 module( 'Video Media Widget' );9 QUnit.module( 'Video Media Widget' ); 10 10 11 test( 'video widget control', function() {11 QUnit.test( 'video widget control', function( assert ) { 12 12 var VideoWidgetControl, videoWidgetControlInstance, videoWidgetModelInstance, mappedProps, testVideoUrl; 13 13 testVideoUrl = 'https://videos.files.wordpress.com/AHz0Ca46/wp4-7-vaughan-r8-mastered_hd.mp4'; 14 equal( typeof wp.mediaWidgets.controlConstructors.media_video, 'function', 'wp.mediaWidgets.controlConstructors.media_video is a function' );14 assert.equal( typeof wp.mediaWidgets.controlConstructors.media_video, 'function', 'wp.mediaWidgets.controlConstructors.media_video is a function' ); 15 15 VideoWidgetControl = wp.mediaWidgets.controlConstructors.media_video; 16 ok( VideoWidgetControl.prototype instanceof wp.mediaWidgets.MediaWidgetControl, 'wp.mediaWidgets.controlConstructors.media_video subclasses wp.mediaWidgets.MediaWidgetControl' );16 assert.ok( VideoWidgetControl.prototype instanceof wp.mediaWidgets.MediaWidgetControl, 'wp.mediaWidgets.controlConstructors.media_video subclasses wp.mediaWidgets.MediaWidgetControl' ); 17 17 18 18 videoWidgetModelInstance = new wp.mediaWidgets.modelConstructors.media_video(); … … 26 26 videoWidgetControlInstance.model.set({ error: false, url: testVideoUrl, loop: false, preload: 'meta' }); 27 27 mappedProps = videoWidgetControlInstance.mapModelToMediaFrameProps( videoWidgetControlInstance.model.toJSON() ); 28 equal( mappedProps.url, testVideoUrl, 'mapModelToMediaFrameProps should set url' );29 equal( mappedProps.loop, false, 'mapModelToMediaFrameProps should set loop' );30 equal( mappedProps.preload, 'meta', 'mapModelToMediaFrameProps should set preload' );28 assert.equal( mappedProps.url, testVideoUrl, 'mapModelToMediaFrameProps should set url' ); 29 assert.equal( mappedProps.loop, false, 'mapModelToMediaFrameProps should set loop' ); 30 assert.equal( mappedProps.preload, 'meta', 'mapModelToMediaFrameProps should set preload' ); 31 31 32 32 // Test mapMediaToModelProps(). 33 33 mappedProps = videoWidgetControlInstance.mapMediaToModelProps( { loop: false, preload: 'meta', url: testVideoUrl, title: 'random movie file title' } ); 34 equal( mappedProps.title, undefined, 'mapMediaToModelProps should ignore title inputs' );35 equal( mappedProps.loop, false, 'mapMediaToModelProps should set loop' );36 equal( mappedProps.preload, 'meta', 'mapMediaToModelProps should set preload' );34 assert.equal( mappedProps.title, undefined, 'mapMediaToModelProps should ignore title inputs' ); 35 assert.equal( mappedProps.loop, false, 'mapMediaToModelProps should set loop' ); 36 assert.equal( mappedProps.preload, 'meta', 'mapMediaToModelProps should set preload' ); 37 37 }); 38 38 39 test( 'video widget control renderPreview', function( assert ) {39 QUnit.test( 'video widget control renderPreview', function( assert ) { 40 40 var videoWidgetControlInstance, videoWidgetModelInstance, done; 41 41 done = assert.async(); … … 47 47 model: videoWidgetModelInstance 48 48 }); 49 equal( videoWidgetControlInstance.$el.find( 'a' ).length, 0, 'No video links should be rendered' );49 assert.equal( videoWidgetControlInstance.$el.find( 'a' ).length, 0, 'No video links should be rendered' ); 50 50 videoWidgetControlInstance.model.set({ error: false, url: 'https://videos.files.wordpress.com/AHz0Ca46/wp4-7-vaughan-r8-mastered_hd.mp4' }); 51 51 52 52 // Due to renderPreview being deferred. 53 53 setTimeout( function() { 54 equal( videoWidgetControlInstance.$el.find( 'a[href="https://videos.files.wordpress.com/AHz0Ca46/wp4-7-vaughan-r8-mastered_hd.mp4"]' ).length, 1, 'One video link should be rendered' );54 assert.equal( videoWidgetControlInstance.$el.find( 'a[href="https://videos.files.wordpress.com/AHz0Ca46/wp4-7-vaughan-r8-mastered_hd.mp4"]' ).length, 1, 'One video link should be rendered' ); 55 55 done(); 56 56 }, 50 ); 57 start(); 57 58 done(); 58 59 }); 59 60 60 test( 'video media model', function() {61 QUnit.test( 'video media model', function( assert ) { 61 62 var VideoWidgetModel, videoWidgetModelInstance; 62 equal( typeof wp.mediaWidgets.modelConstructors.media_video, 'function', 'wp.mediaWidgets.modelConstructors.media_video is a function' );63 assert.equal( typeof wp.mediaWidgets.modelConstructors.media_video, 'function', 'wp.mediaWidgets.modelConstructors.media_video is a function' ); 63 64 VideoWidgetModel = wp.mediaWidgets.modelConstructors.media_video; 64 ok( VideoWidgetModel.prototype instanceof wp.mediaWidgets.MediaWidgetModel, 'wp.mediaWidgets.modelConstructors.media_video subclasses wp.mediaWidgets.MediaWidgetModel' );65 assert.ok( VideoWidgetModel.prototype instanceof wp.mediaWidgets.MediaWidgetModel, 'wp.mediaWidgets.modelConstructors.media_video subclasses wp.mediaWidgets.MediaWidgetModel' ); 65 66 66 67 videoWidgetModelInstance = new VideoWidgetModel(); 67 68 _.each( videoWidgetModelInstance.attributes, function( value, key ) { 68 equal( value, VideoWidgetModel.prototype.schema[ key ][ 'default' ], 'Should properly set default for ' + key );69 assert.equal( value, VideoWidgetModel.prototype.schema[ key ][ 'default' ], 'Should properly set default for ' + key ); 69 70 }); 70 71 }); -
trunk/tests/qunit/wp-admin/js/widgets/test-media-widgets.js
r46586 r47512 3 3 /* eslint-env qunit */ 4 4 5 ( function() {5 ( function() { 6 6 'use strict'; 7 7 8 module( 'Media Widgets' );8 QUnit.module( 'Media Widgets' ); 9 9 10 test( 'namespace', function() {11 equal( typeof wp.mediaWidgets, 'object', 'wp.mediaWidgets is an object' );12 equal( typeof wp.mediaWidgets.controlConstructors, 'object', 'wp.mediaWidgets.controlConstructors is an object' );13 equal( typeof wp.mediaWidgets.modelConstructors, 'object', 'wp.mediaWidgets.modelConstructors is an object' );14 equal( typeof wp.mediaWidgets.widgetControls, 'object', 'wp.mediaWidgets.widgetControls is an object' );15 equal( typeof wp.mediaWidgets.handleWidgetAdded, 'function', 'wp.mediaWidgets.handleWidgetAdded is an function' );16 equal( typeof wp.mediaWidgets.handleWidgetUpdated, 'function', 'wp.mediaWidgets.handleWidgetUpdated is an function' );17 equal( typeof wp.mediaWidgets.init, 'function', 'wp.mediaWidgets.init is an function' );10 QUnit.test( 'namespace', function( assert ) { 11 assert.equal( typeof wp.mediaWidgets, 'object', 'wp.mediaWidgets is an object' ); 12 assert.equal( typeof wp.mediaWidgets.controlConstructors, 'object', 'wp.mediaWidgets.controlConstructors is an object' ); 13 assert.equal( typeof wp.mediaWidgets.modelConstructors, 'object', 'wp.mediaWidgets.modelConstructors is an object' ); 14 assert.equal( typeof wp.mediaWidgets.widgetControls, 'object', 'wp.mediaWidgets.widgetControls is an object' ); 15 assert.equal( typeof wp.mediaWidgets.handleWidgetAdded, 'function', 'wp.mediaWidgets.handleWidgetAdded is an function' ); 16 assert.equal( typeof wp.mediaWidgets.handleWidgetUpdated, 'function', 'wp.mediaWidgets.handleWidgetUpdated is an function' ); 17 assert.equal( typeof wp.mediaWidgets.init, 'function', 'wp.mediaWidgets.init is an function' ); 18 18 }); 19 19 20 test( 'media widget control', function() {21 equal( typeof wp.mediaWidgets.MediaWidgetControl, 'function', 'wp.mediaWidgets.MediaWidgetControl' );22 ok( wp.mediaWidgets.MediaWidgetControl.prototype instanceof Backbone.View, 'wp.mediaWidgets.MediaWidgetControl subclasses Backbone.View' );20 QUnit.test( 'media widget control', function( assert ) { 21 assert.equal( typeof wp.mediaWidgets.MediaWidgetControl, 'function', 'wp.mediaWidgets.MediaWidgetControl' ); 22 assert.ok( wp.mediaWidgets.MediaWidgetControl.prototype instanceof Backbone.View, 'wp.mediaWidgets.MediaWidgetControl subclasses Backbone.View' ); 23 23 }); 24 24 25 test( 'media widget model', function() {25 QUnit.test( 'media widget model', function( assert ) { 26 26 var widgetModelInstance; 27 equal( typeof wp.mediaWidgets.MediaWidgetModel, 'function', 'wp.mediaWidgets.MediaWidgetModel is a function' );28 ok( wp.mediaWidgets.MediaWidgetModel.prototype instanceof Backbone.Model, 'wp.mediaWidgets.MediaWidgetModel subclasses Backbone.Model' );27 assert.equal( typeof wp.mediaWidgets.MediaWidgetModel, 'function', 'wp.mediaWidgets.MediaWidgetModel is a function' ); 28 assert.ok( wp.mediaWidgets.MediaWidgetModel.prototype instanceof Backbone.Model, 'wp.mediaWidgets.MediaWidgetModel subclasses Backbone.Model' ); 29 29 30 30 widgetModelInstance = new wp.mediaWidgets.MediaWidgetModel(); 31 equal( widgetModelInstance.get( 'title' ), '', 'wp.mediaWidgets.MediaWidgetModel defaults title to empty string' );32 equal( widgetModelInstance.get( 'attachment_id' ), 0, 'wp.mediaWidgets.MediaWidgetModel defaults attachment_id to 0' );33 equal( widgetModelInstance.get( 'url' ), 0, 'wp.mediaWidgets.MediaWidgetModel defaults url to empty string' );31 assert.equal( widgetModelInstance.get( 'title' ), '', 'wp.mediaWidgets.MediaWidgetModel defaults title to empty string' ); 32 assert.equal( widgetModelInstance.get( 'attachment_id' ), 0, 'wp.mediaWidgets.MediaWidgetModel defaults attachment_id to 0' ); 33 assert.equal( widgetModelInstance.get( 'url' ), 0, 'wp.mediaWidgets.MediaWidgetModel defaults url to empty string' ); 34 34 35 35 widgetModelInstance.set({ … … 38 38 url: 'https://wordpress.org' 39 39 }); 40 equal( widgetModelInstance.get( 'title' ), 'chicken and ribs', 'wp.mediaWidgets.MediaWidgetModel properly sets the title attribute' );41 equal( widgetModelInstance.get( 'url' ), 'https://wordpress.org', 'wp.mediaWidgets.MediaWidgetModel properly sets the url attribute' );42 equal( widgetModelInstance.get( 'attachment_id' ), 1, 'wp.mediaWidgets.MediaWidgetModel properly sets and casts the attachment_id attribute' );40 assert.equal( widgetModelInstance.get( 'title' ), 'chicken and ribs', 'wp.mediaWidgets.MediaWidgetModel properly sets the title attribute' ); 41 assert.equal( widgetModelInstance.get( 'url' ), 'https://wordpress.org', 'wp.mediaWidgets.MediaWidgetModel properly sets the url attribute' ); 42 assert.equal( widgetModelInstance.get( 'attachment_id' ), 1, 'wp.mediaWidgets.MediaWidgetModel properly sets and casts the attachment_id attribute' ); 43 43 }); 44 44 -
trunk/tests/qunit/wp-includes/js/shortcode.js
r47122 r47512 1 1 /* global wp, jQuery */ 2 2 jQuery( function() { 3 module( 'shortcode' );4 5 test( 'next() should find the shortcode', function() {3 QUnit.module( 'shortcode' ); 4 5 QUnit.test( 'next() should find the shortcode', function( assert ) { 6 6 var result; 7 7 8 8 // Basic. 9 9 result = wp.shortcode.next( 'foo', 'this has the [foo] shortcode' ); 10 equal( result.index, 13, 'foo shortcode found at index 13' );10 assert.equal( result.index, 13, 'foo shortcode found at index 13' ); 11 11 12 12 result = wp.shortcode.next( 'foo', 'this has the [foo param="foo"] shortcode' ); 13 equal( result.index, 13, 'foo shortcode with params found at index 13' );14 }); 15 16 test( 'next() should not find shortcodes that are not there', function() {13 assert.equal( result.index, 13, 'foo shortcode with params found at index 13' ); 14 }); 15 16 QUnit.test( 'next() should not find shortcodes that are not there', function( assert ) { 17 17 var result; 18 18 19 19 // Not found. 20 20 result = wp.shortcode.next( 'bar', 'this has the [foo] shortcode' ); 21 equal( result, undefined, 'bar shortcode not found' );21 assert.equal( result, undefined, 'bar shortcode not found' ); 22 22 23 23 result = wp.shortcode.next( 'bar', 'this has the [foo param="bar"] shortcode' ); 24 equal( result, undefined, 'bar shortcode not found with params' );25 }); 26 27 test( 'next() should find the shortcode when told to start looking beyond the start of the string', function() {24 assert.equal( result, undefined, 'bar shortcode not found with params' ); 25 }); 26 27 QUnit.test( 'next() should find the shortcode when told to start looking beyond the start of the string', function( assert ) { 28 28 var result; 29 29 30 30 // Starting at indices. 31 31 result = wp.shortcode.next( 'foo', 'this has the [foo] shortcode', 12 ); 32 equal( result.index, 13, 'foo shortcode found before index 13' );32 assert.equal( result.index, 13, 'foo shortcode found before index 13' ); 33 33 34 34 result = wp.shortcode.next( 'foo', 'this has the [foo] shortcode', 13 ); 35 equal( result.index, 13, 'foo shortcode found at index 13' );35 assert.equal( result.index, 13, 'foo shortcode found at index 13' ); 36 36 37 37 result = wp.shortcode.next( 'foo', 'this has the [foo] shortcode', 14 ); 38 equal( result, undefined, 'foo shortcode not found after index 13' );39 }); 40 41 test( 'next() should find the second instances of the shortcode when the starting indice is after the start of the first one', function() {38 assert.equal( result, undefined, 'foo shortcode not found after index 13' ); 39 }); 40 41 QUnit.test( 'next() should find the second instances of the shortcode when the starting indice is after the start of the first one', function( assert ) { 42 42 var result; 43 43 44 44 result = wp.shortcode.next( 'foo', 'this has the [foo] shortcode [foo] twice', 14 ); 45 equal( result.index, 29, 'foo shortcode found the second foo at index 29' );46 }); 47 48 49 test( 'next() should not find escaped shortcodes', function() {45 assert.equal( result.index, 29, 'foo shortcode found the second foo at index 29' ); 46 }); 47 48 49 QUnit.test( 'next() should not find escaped shortcodes', function( assert ) { 50 50 var result; 51 51 52 52 // Escaped. 53 53 result = wp.shortcode.next( 'foo', 'this has the [[foo]] shortcode' ); 54 equal( result, undefined, 'foo shortcode not found when escaped' );54 assert.equal( result, undefined, 'foo shortcode not found when escaped' ); 55 55 56 56 result = wp.shortcode.next( 'foo', 'this has the [[foo param="foo"]] shortcode' ); 57 equal( result, undefined, 'foo shortcode not found when escaped with params' );58 }); 59 60 test( 'next() should find shortcodes that are incorrectly escaped by newlines', function() {57 assert.equal( result, undefined, 'foo shortcode not found when escaped with params' ); 58 }); 59 60 QUnit.test( 'next() should find shortcodes that are incorrectly escaped by newlines', function( assert ) { 61 61 var result; 62 62 63 63 result = wp.shortcode.next( 'foo', 'this has the [\n[foo]] shortcode' ); 64 equal( result.index, 15, 'shortcode found when incorrectly escaping the start of it' );64 assert.equal( result.index, 15, 'shortcode found when incorrectly escaping the start of it' ); 65 65 66 66 result = wp.shortcode.next( 'foo', 'this has the [[foo]\n] shortcode' ); 67 equal( result.index, 14, 'shortcode found when incorrectly escaping the end of it' );68 }); 69 70 test( 'next() should still work when there are not equal ammounts of square brackets', function() {67 assert.equal( result.index, 14, 'shortcode found when incorrectly escaping the end of it' ); 68 }); 69 70 QUnit.test( 'next() should still work when there are not equal ammounts of square brackets', function( assert ) { 71 71 var result; 72 72 73 73 result = wp.shortcode.next( 'foo', 'this has the [[foo] shortcode' ); 74 equal( result.index, 14, 'shortcode found when there are offset square brackets' );74 assert.equal( result.index, 14, 'shortcode found when there are offset square brackets' ); 75 75 76 76 result = wp.shortcode.next( 'foo', 'this has the [foo]] shortcode' ); 77 equal( result.index, 13, 'shortcode found when there are offset square brackets' );78 }); 79 80 test( 'next() should find the second instances of the shortcode when the first one is escaped', function() {77 assert.equal( result.index, 13, 'shortcode found when there are offset square brackets' ); 78 }); 79 80 QUnit.test( 'next() should find the second instances of the shortcode when the first one is escaped', function( assert ) { 81 81 var result; 82 82 83 83 84 84 result = wp.shortcode.next( 'foo', 'this has the [[foo]] shortcode [foo] twice' ); 85 equal( result.index, 31, 'foo shortcode found the non-escaped foo at index 31' );86 }); 87 88 test( 'next() should not find shortcodes that are not full matches', function() {85 assert.equal( result.index, 31, 'foo shortcode found the non-escaped foo at index 31' ); 86 }); 87 88 QUnit.test( 'next() should not find shortcodes that are not full matches', function( assert ) { 89 89 var result; 90 90 91 91 // Stubs. 92 92 result = wp.shortcode.next( 'foo', 'this has the [foobar] shortcode' ); 93 equal( result, undefined, 'stub does not trigger match' );93 assert.equal( result, undefined, 'stub does not trigger match' ); 94 94 95 95 result = wp.shortcode.next( 'foobar', 'this has the [foo] shortcode' ); 96 equal( result, undefined, 'stub does not trigger match' );97 }); 98 99 test( 'replace() should replace the shortcode', function() {96 assert.equal( result, undefined, 'stub does not trigger match' ); 97 }); 98 99 QUnit.test( 'replace() should replace the shortcode', function( assert ) { 100 100 var result; 101 101 102 102 // Basic. 103 103 result = wp.shortcode.replace( 'foo', 'this has the [foo] shortcode', shortcodeReplaceCallback ); 104 equal( result, 'this has the bar shortcode', 'foo replaced with bar' );104 assert.equal( result, 'this has the bar shortcode', 'foo replaced with bar' ); 105 105 106 106 result = wp.shortcode.replace( 'foo', 'this has the [foo param="foo"] shortcode', shortcodeReplaceCallback ); 107 equal( result, 'this has the bar shortcode', 'foo and params replaced with bar' );108 }); 109 110 test( 'replace() should not replace the shortcode when it does not match', function() {107 assert.equal( result, 'this has the bar shortcode', 'foo and params replaced with bar' ); 108 }); 109 110 QUnit.test( 'replace() should not replace the shortcode when it does not match', function( assert ) { 111 111 var result; 112 112 113 113 // Not found. 114 114 result = wp.shortcode.replace( 'bar', 'this has the [foo] shortcode', shortcodeReplaceCallback ); 115 equal( result, 'this has the [foo] shortcode', 'bar not found' );115 assert.equal( result, 'this has the [foo] shortcode', 'bar not found' ); 116 116 117 117 result = wp.shortcode.replace( 'bar', 'this has the [foo param="bar"] shortcode', shortcodeReplaceCallback ); 118 equal( result, 'this has the [foo param="bar"] shortcode', 'bar not found with params' );119 }); 120 121 test( 'replace() should replace the shortcode in all instances of its use', function() {118 assert.equal( result, 'this has the [foo param="bar"] shortcode', 'bar not found with params' ); 119 }); 120 121 QUnit.test( 'replace() should replace the shortcode in all instances of its use', function( assert ) { 122 122 var result; 123 123 124 124 // Multiple instances. 125 125 result = wp.shortcode.replace( 'foo', 'this has the [foo] shortcode [foo] twice', shortcodeReplaceCallback ); 126 equal( result, 'this has the bar shortcode bar twice', 'foo replaced with bar twice' );126 assert.equal( result, 'this has the bar shortcode bar twice', 'foo replaced with bar twice' ); 127 127 128 128 result = wp.shortcode.replace( 'foo', 'this has the [foo param="foo"] shortcode [foo] twice', shortcodeReplaceCallback ); 129 equal( result, 'this has the bar shortcode bar twice', 'foo and params replaced with bar twice' );130 }); 131 132 test( 'replace() should not replace the escaped shortcodes', function() {129 assert.equal( result, 'this has the bar shortcode bar twice', 'foo and params replaced with bar twice' ); 130 }); 131 132 QUnit.test( 'replace() should not replace the escaped shortcodes', function( assert ) { 133 133 var result; 134 134 135 135 // Escaped. 136 136 result = wp.shortcode.replace( 'foo', 'this has the [[foo]] shortcode', shortcodeReplaceCallback ); 137 equal( result, 'this has the [[foo]] shortcode', 'escaped foo not replaced' );137 assert.equal( result, 'this has the [[foo]] shortcode', 'escaped foo not replaced' ); 138 138 139 139 result = wp.shortcode.replace( 'foo', 'this has the [[foo param="bar"]] shortcode', shortcodeReplaceCallback ); 140 equal( result, 'this has the [[foo param="bar"]] shortcode', 'escaped foo with params not replaced' );140 assert.equal( result, 'this has the [[foo param="bar"]] shortcode', 'escaped foo with params not replaced' ); 141 141 142 142 result = wp.shortcode.replace( 'foo', 'this [foo] has the [[foo param="bar"]] shortcode escaped', shortcodeReplaceCallback ); 143 equal( result, 'this bar has the [[foo param="bar"]] shortcode escaped', 'escaped foo with params not replaced but unescaped foo replaced' );144 }); 145 146 test( 'replace() should replace improperly escaped shortcodes that include newlines', function() {143 assert.equal( result, 'this bar has the [[foo param="bar"]] shortcode escaped', 'escaped foo with params not replaced but unescaped foo replaced' ); 144 }); 145 146 QUnit.test( 'replace() should replace improperly escaped shortcodes that include newlines', function( assert ) { 147 147 var result; 148 148 149 149 result = wp.shortcode.replace( 'foo', 'this [foo] has the [[foo param="bar"]\n] shortcode ', shortcodeReplaceCallback ); 150 equal( result, 'this bar has the [bar\n] shortcode ', 'escaping with newlines should not actually escape the content' );150 assert.equal( result, 'this bar has the [bar\n] shortcode ', 'escaping with newlines should not actually escape the content' ); 151 151 152 152 result = wp.shortcode.replace( 'foo', 'this [foo] has the [\n[foo param="bar"]] shortcode ', shortcodeReplaceCallback ); 153 equal( result, 'this bar has the [\nbar] shortcode ', 'escaping with newlines should not actually escape the content' );154 }); 155 156 test( 'replace() should not replace the shortcode when it is an incomplete match', function() {153 assert.equal( result, 'this bar has the [\nbar] shortcode ', 'escaping with newlines should not actually escape the content' ); 154 }); 155 156 QUnit.test( 'replace() should not replace the shortcode when it is an incomplete match', function( assert ) { 157 157 var result; 158 158 159 159 // Stubs. 160 160 result = wp.shortcode.replace( 'foo', 'this has the [foobar] shortcode', shortcodeReplaceCallback ); 161 equal( result, 'this has the [foobar] shortcode', 'stub not replaced' );161 assert.equal( result, 'this has the [foobar] shortcode', 'stub not replaced' ); 162 162 163 163 result = wp.shortcode.replace( 'foobar', 'this has the [foo] shortcode', shortcodeReplaceCallback ); 164 equal( result, 'this has the [foo] shortcode', 'stub not replaced' );164 assert.equal( result, 'this has the [foo] shortcode', 'stub not replaced' ); 165 165 }); 166 166 … … 172 172 } 173 173 174 test( 'attrs() should return named attributes created with single, double, and no quotes', function() {174 QUnit.test( 'attrs() should return named attributes created with single, double, and no quotes', function( assert ) { 175 175 var expected = { 176 176 'named': { … … 181 181 }; 182 182 183 deepEqual( wp.shortcode.attrs('param="foo" another=\'bar\' andagain=baz'), expected, 'attr parsed all three named types');183 assert.deepEqual( wp.shortcode.attrs('param="foo" another=\'bar\' andagain=baz'), expected, 'attr parsed all three named types'); 184 184 }); 185 185 186 test( 'attrs() should return numeric attributes in the order they are used', function() {186 QUnit.test( 'attrs() should return numeric attributes in the order they are used', function( assert ) { 187 187 var expected = { 188 188 'named': {}, 'numeric' : ['foo', 'bar', 'baz'] 189 189 }; 190 190 191 deepEqual( wp.shortcode.attrs('foo bar baz'), expected, 'attr parsed numeric attributes');191 assert.deepEqual( wp.shortcode.attrs('foo bar baz'), expected, 'attr parsed numeric attributes'); 192 192 }); 193 193 194 test( 'attrs() should return numeric attributes in the order they are used when they have named attributes in between', function() {194 QUnit.test( 'attrs() should return numeric attributes in the order they are used when they have named attributes in between', function( assert ) { 195 195 var expected = { 196 196 'named': { 'not': 'a blocker' }, 'numeric' : ['foo', 'bar', 'baz'] 197 197 }; 198 198 199 deepEqual( wp.shortcode.attrs('foo not="a blocker" bar baz'), expected, 'attr parsed numeric attributes');199 assert.deepEqual( wp.shortcode.attrs('foo not="a blocker" bar baz'), expected, 'attr parsed numeric attributes'); 200 200 }); 201 201 202 test( 'attrs() should return numeric attributes created with single, double, and no quotes', function() {202 QUnit.test( 'attrs() should return numeric attributes created with single, double, and no quotes', function( assert ) { 203 203 var expected = { 204 204 'named': {}, 'numeric' : ['foo', 'bar', 'baz'] 205 205 }; 206 206 207 deepEqual( wp.shortcode.attrs('foo "bar" \'baz\''), expected, 'attr parsed numeric attributes');207 assert.deepEqual( wp.shortcode.attrs('foo "bar" \'baz\''), expected, 'attr parsed numeric attributes'); 208 208 }); 209 209 210 test( 'attrs() should return mixed attributes created with single, double, and no quotes', function() {210 QUnit.test( 'attrs() should return mixed attributes created with single, double, and no quotes', function( assert ) { 211 211 var expected = { 212 212 'named': { a: 'foo', b: 'bar', c: 'baz' }, 'numeric' : ['foo', 'bar', 'baz'] 213 213 }; 214 214 215 deepEqual( wp.shortcode.attrs('a="foo" b=\'bar\' c=baz foo "bar" \'baz\''), expected, 'attr parsed numeric attributes');216 }); 217 218 test( 'string() should accept attrs in any order', function() {215 assert.deepEqual( wp.shortcode.attrs('a="foo" b=\'bar\' c=baz foo "bar" \'baz\''), expected, 'attr parsed numeric attributes'); 216 }); 217 218 QUnit.test( 'string() should accept attrs in any order', function( assert ) { 219 219 var expected = '[short abc123 foo="bar"]'; 220 220 var result; … … 228 228 } 229 229 }); 230 deepEqual( result, expected, 'attributes are accepted in any order' );230 assert.deepEqual( result, expected, 'attributes are accepted in any order' ); 231 231 232 232 result = wp.shortcode.string({ … … 238 238 } 239 239 }); 240 deepEqual( result, expected, 'attributes are accepted in any order' );240 assert.deepEqual( result, expected, 'attributes are accepted in any order' ); 241 241 }); 242 242 }); -
trunk/tests/qunit/wp-includes/js/tinymce/tinymce-obsolete.js
r40585 r47512 82 82 // Ref: http://www.w3.org/TR/html5/obsolete.html, http://developers.whatwg.org/obsolete.html 83 83 84 QUnit.test('HTML elements non-conforming to HTML 5.0', function( ) {84 QUnit.test('HTML elements non-conforming to HTML 5.0', function( assert ) { 85 85 var testString; 86 86 … … 110 110 */ 111 111 112 expect(6);112 assert.expect(6); 113 113 114 114 text = 'acronym'; 115 115 testString = '<p><acronym title="www">WWW</acronym></p>'; 116 116 editor.setContent( testString ); 117 equal( editor.getContent(), testString, text );117 assert.equal( editor.getContent(), testString, text ); 118 118 119 119 text = 'strike, converted to span'; 120 120 editor.setContent( '<strike>test</strike>' ); 121 equal( editor.getContent(), '<p><span style="text-decoration: line-through;">test</span></p>', text );121 assert.equal( editor.getContent(), '<p><span style="text-decoration: line-through;">test</span></p>', text ); 122 122 123 123 text = 'big'; 124 124 testString = '<p><big>test</big></p>'; 125 125 editor.setContent( testString ); 126 equal( editor.getContent(), testString, text );126 assert.equal( editor.getContent(), testString, text ); 127 127 128 128 text = 'center'; 129 129 testString = '<center>test</center>'; 130 130 editor.setContent( testString ); 131 equal( editor.getContent(), testString, text );131 assert.equal( editor.getContent(), testString, text ); 132 132 133 133 text = 'font, converted to span'; 134 134 editor.setContent( '<p><font size="4">test</font></p>' ); 135 equal( editor.getContent(), '<p><span style="font-size: large;">test</span></p>', text );135 assert.equal( editor.getContent(), '<p><span style="font-size: large;">test</span></p>', text ); 136 136 137 137 text = 'tt'; 138 138 testString = '<p><tt>test</tt></p>'; 139 139 editor.setContent( testString ); 140 equal( editor.getContent(), testString, text );140 assert.equal( editor.getContent(), testString, text ); 141 141 }); 142 142 143 QUnit.test('Obsolete (but still conforming) HTML attributes', function( ) {143 QUnit.test('Obsolete (but still conforming) HTML attributes', function( assert ) { 144 144 var testString; 145 145 146 expect(3);146 assert.expect(3); 147 147 148 148 text = 'border on <img>'; 149 149 testString = '<p><img src="../../test.gif" alt="" border="5" /></p>'; 150 150 editor.setContent( testString ); 151 equal( editor.getContent(), testString, text );151 assert.equal( editor.getContent(), testString, text ); 152 152 153 153 text = 'Old style anchors'; 154 154 testString = '<p><a name="test"></a></p>'; 155 155 editor.setContent( testString ); 156 equal( editor.getContent(), testString, text );156 assert.equal( editor.getContent(), testString, text ); 157 157 158 158 text = 'maxlength, size on input type="number"'; 159 159 testString = '<p><input maxlength="5" size="10" type="number" value="" /></p>'; 160 160 editor.setContent( testString ); 161 ok( hasAttr( editor.getContent(), { input: 'maxlength size' } ), text );161 assert.ok( hasAttr( editor.getContent(), { input: 'maxlength size' } ), text ); 162 162 }); 163 163 164 QUnit.test('Obsolete attributes in HTML 5.0', function( ) {164 QUnit.test('Obsolete attributes in HTML 5.0', function( assert ) { 165 165 var testString, text; 166 166 167 expect(22);167 assert.expect(22); 168 168 169 169 text = 'charset, rev, shape, coords on <a> elements'; 170 170 testString = '<p><a href="javascript;:" charset="en" rev="made" shape="rect" coords="5,5">test</a></p>'; 171 171 editor.setContent( testString ); 172 ok( hasAttr( editor.getContent(), { a: 'charset rev shape coords' } ), text );172 assert.ok( hasAttr( editor.getContent(), { a: 'charset rev shape coords' } ), text ); 173 173 174 174 text = 'name, align, hspace, vspace on img elements'; 175 175 testString = '<p><img src="../../test.gif" alt="" name="test" align="left" hspace="5" vspace="5" /></p>'; 176 176 editor.setContent( testString ); 177 ok( hasAttr( editor.getContent(), { img: 'name align hspace vspace' } ), text );177 assert.ok( hasAttr( editor.getContent(), { img: 'name align hspace vspace' } ), text ); 178 178 179 179 text = 'name, align, hspace, vspace, on embed elements'; 180 180 testString = '<p><embed width="100" height="100" src="test.swf" vspace="5" hspace="5" align="left" name="test"></embed></p>'; 181 181 editor.setContent( testString ); 182 ok( hasAttr( editor.getContent(), { embed: 'name align hspace vspace' } ), text );182 assert.ok( hasAttr( editor.getContent(), { embed: 'name align hspace vspace' } ), text ); 183 183 184 184 text = 'archive, classid, code, codebase, codetype, declare, standby on object elements'; 185 185 testString = '<p><object width="100" height="100" classid="clsid" codebase="clsid" standby="standby" codetype="1" code="1" archive="1" declare="declare"></object></p>'; 186 186 editor.setContent( testString ); 187 ok( hasAttr( editor.getContent(), { object: 'archive classid code codebase codetype declare standby' } ), text );187 assert.ok( hasAttr( editor.getContent(), { object: 'archive classid code codebase codetype declare standby' } ), text ); 188 188 189 189 text = 'type, valuetype on param elements'; 190 190 testString = '<p><object width="100" height="100"><param type="" valuetype="" /></object></p>'; 191 191 editor.setContent( testString ); 192 ok( hasAttr( editor.getContent(), { param: 'type valuetype' } ), text );192 assert.ok( hasAttr( editor.getContent(), { param: 'type valuetype' } ), text ); 193 193 194 194 text = 'align, bgcolor, border, cellpadding, cellspacing, frame, rules, summary, width on table elements'; 195 195 testString = '<table border="1" summary="" width="100" frame="" rules="" cellspacing="5" cellpadding="5" align="left" bgcolor="blue"><tbody><tr><td>test</td></tr></tbody></table>'; 196 196 editor.setContent( testString ); 197 ok( hasAttr( editor.getContent(), { table: 'align bgcolor border cellpadding cellspacing frame rules summary width' } ), text );197 assert.ok( hasAttr( editor.getContent(), { table: 'align bgcolor border cellpadding cellspacing frame rules summary width' } ), text ); 198 198 199 199 text = 'align, char, charoff, valign on tbody, thead, and tfoot elements'; 200 200 testString = '<table><thead align="left" char="" charoff="" valign="top"></thead><tfoot align="left" char="" charoff="" valign="top"></tfoot><tbody align="left" char="" charoff="" valign="top"><tr><th>test</th><td>test</td></tr></tbody></table>'; 201 201 editor.setContent( testString ); 202 ok( hasAttr( editor.getContent(), {202 assert.ok( hasAttr( editor.getContent(), { 203 203 thead: 'align char charoff valign', 204 204 tfoot: 'align char charoff valign', … … 209 209 testString = '<table><tbody><tr><th axis="" align="left" char="" charoff="" valign="top" nowrap="nowrap" bgcolor="blue" width="100" height="10">test</th><td axis="" align="left" char="" charoff="" valign="top" nowrap="nowrap" bgcolor="blue" width="100" height="10" scope="">test</td></tr></tbody></table>'; 210 210 editor.setContent( testString ); 211 ok( hasAttr( editor.getContent(), {211 assert.ok( hasAttr( editor.getContent(), { 212 212 th: 'axis align bgcolor char charoff height nowrap valign width', 213 213 td: 'axis align bgcolor char charoff height nowrap valign width scope' … … 217 217 testString = '<table><tbody><tr align="left" char="" charoff="" valign="top" bgcolor="blue"><td>test</td></tr></tbody></table>'; 218 218 editor.setContent( testString ); 219 ok( hasAttr( editor.getContent(), { tr: 'align bgcolor char charoff valign' } ), text );219 assert.ok( hasAttr( editor.getContent(), { tr: 'align bgcolor char charoff valign' } ), text ); 220 220 221 221 text = 'clear on br elements'; 222 222 testString = '<p>test<br clear="all" />test</p>'; 223 223 editor.setContent( testString ); 224 equal( editor.getContent(), testString, text );224 assert.equal( editor.getContent(), testString, text ); 225 225 226 226 text = 'align on caption elements'; 227 227 testString = '<table><caption align="left">test</caption><tbody><tr><td>test</td></tr></tbody></table>'; 228 228 editor.setContent( testString ); 229 equal( editor.getContent(), testString, text );229 assert.equal( editor.getContent(), testString, text ); 230 230 231 231 text = 'align, char, charoff, valign, width on col elements'; 232 232 testString = '<table><colgroup><col width="100" align="left" char="a" charoff="1" valign="top" /><col /></colgroup><tbody><tr><td>test</td><td>test</td></tr></tbody></table>'; 233 233 editor.setContent( testString ); 234 ok( hasAttr( editor.getContent(), { col: 'align char charoff valign width' } ), text );234 assert.ok( hasAttr( editor.getContent(), { col: 'align char charoff valign width' } ), text ); 235 235 236 236 text = 'align on div, h1—h6, input, legend, p elements'; 237 237 testString = '<div align="left">1</div><h3 align="left">1</h3><p align="left">1</p><form><fieldset><legend align="left">test</legend><input type="text" align="left" /></fieldset></form>'; 238 238 editor.setContent( testString ); 239 equal( editor.getContent(), testString, text );239 assert.equal( editor.getContent(), testString, text ); 240 240 241 241 text = 'compact on dl elements'; 242 242 testString = '<dl compact="compact"><dd>1</dd></dl>'; 243 243 editor.setContent( testString ); 244 equal( editor.getContent(), testString, text );244 assert.equal( editor.getContent(), testString, text ); 245 245 246 246 text = 'align, hspace, vspace on embed elements'; 247 247 testString = '<p><embed width="100" height="100" vspace="5" hspace="5" align="left"></embed></p>'; 248 248 editor.setContent( testString ); 249 ok( hasAttr( editor.getContent(), { embed: 'align hspace vspace' } ), text );249 assert.ok( hasAttr( editor.getContent(), { embed: 'align hspace vspace' } ), text ); 250 250 251 251 text = 'align, noshade, size, width on hr elements'; 252 252 testString = '<hr align="left" noshade="noshade" size="1" width="100" />'; 253 253 editor.setContent( testString ); 254 ok( hasAttr( editor.getContent(), { hr: 'align noshade size width' } ), text );254 assert.ok( hasAttr( editor.getContent(), { hr: 'align noshade size width' } ), text ); 255 255 256 256 text = 'align, frameborder, marginheight, marginwidth, scrolling on iframe elements'; 257 257 testString = '<p><iframe width="100" height="100" frameborder="1" marginwidth="5" marginheight="5" scrolling="" align="left"></iframe></p>'; 258 258 editor.setContent( testString ); 259 ok( hasAttr( editor.getContent(), { iframe: 'align frameborder marginheight marginwidth scrolling' } ), text );259 assert.ok( hasAttr( editor.getContent(), { iframe: 'align frameborder marginheight marginwidth scrolling' } ), text ); 260 260 261 261 text = 'type on li elements'; 262 262 testString = '<ul><li type="disc">test</li></ul>'; 263 263 editor.setContent( testString ); 264 equal( editor.getContent(), testString, text );264 assert.equal( editor.getContent(), testString, text ); 265 265 266 266 text = 'align, border, hspace, vspace on object elements'; 267 267 testString = '<p><object width="100" height="100" border="1" vspace="5" hspace="5" align="left"></object></p>'; 268 268 editor.setContent( testString ); 269 ok( hasAttr( editor.getContent(), { object: 'align border hspace vspace' } ), text );269 assert.ok( hasAttr( editor.getContent(), { object: 'align border hspace vspace' } ), text ); 270 270 271 271 text = 'compact on ol elements'; 272 272 testString = '<ol compact="compact"><li>test</li></ol>'; 273 273 editor.setContent( testString ); 274 equal( editor.getContent(), testString, text );274 assert.equal( editor.getContent(), testString, text ); 275 275 276 276 text = 'compact, type on ul elements'; 277 277 testString = '<ul type="disc" compact="compact"><li>test</li></ul>'; 278 278 editor.setContent( testString ); 279 ok( hasAttr( editor.getContent(), { ul: 'compact type' } ), text );279 assert.ok( hasAttr( editor.getContent(), { ul: 'compact type' } ), text ); 280 280 281 281 text = 'width on pre elements'; 282 282 testString = '<pre width="100">1</pre>'; 283 283 editor.setContent( testString ); 284 equal( editor.getContent(), testString, text );284 assert.equal( editor.getContent(), testString, text ); 285 285 }); 286 286 -
trunk/tests/qunit/wp-includes/js/wp-api.js
r46586 r47512 1 1 /* global wp, JSON */ 2 2 ( function( QUnit ) { 3 module( 'wpapi' );3 QUnit.module( 'wpapi' ); 4 4 5 5 QUnit.test( 'API Loaded correctly', function( assert ) { … … 123 123 _.each( modelsWithIdsClassNames, function( className ) { 124 124 125 QUnit.test( 'Checking ' + className + ' model.' 125 QUnit.test( 'Checking ' + className + ' model.', function( assert ) { 126 126 var done = assert.async(); 127 127 … … 161 161 _.each( modelsWithIndexes, function( className ) { 162 162 163 QUnit.test( 'Testing ' + className + ' model.' 163 QUnit.test( 'Testing ' + className + ' model.', function( assert ) { 164 164 var done = assert.async(); 165 165 … … 297 297 // Check that we have and can get each model type. 298 298 _.each( customClasses, function( className ) { 299 QUnit.test( 'Checking ' + className + ' class name.' 299 QUnit.test( 'Checking ' + className + ' class name.', function( assert ) { 300 300 var done = assert.async(); 301 301 … … 317 317 // Check connecting to a second URL. 318 318 wp.api.loadPromise.done( function() { 319 QUnit.test( 'Checking connecting to a remote url.' 319 QUnit.test( 'Checking connecting to a remote url.', function( assert ) { 320 320 var done = assert.async(); 321 321
Note: See TracChangeset
for help on using the changeset viewer.