@wordpress/style-engine 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/build/styles/border/index.js +2 -2
  3. package/build/styles/border/index.js.map +1 -1
  4. package/build/styles/dimensions/index.js +21 -0
  5. package/build/styles/dimensions/index.js.map +1 -0
  6. package/build/styles/index.js +3 -1
  7. package/build/styles/index.js.map +1 -1
  8. package/build/styles/utils.js +2 -2
  9. package/build/styles/utils.js.map +1 -1
  10. package/build-module/styles/border/index.js +2 -2
  11. package/build-module/styles/border/index.js.map +1 -1
  12. package/build-module/styles/dimensions/index.js +12 -0
  13. package/build-module/styles/dimensions/index.js.map +1 -0
  14. package/build-module/styles/index.js +2 -1
  15. package/build-module/styles/index.js.map +1 -1
  16. package/build-module/styles/utils.js +2 -2
  17. package/build-module/styles/utils.js.map +1 -1
  18. package/build-types/styles/dimensions/index.d.ts +10 -0
  19. package/build-types/styles/dimensions/index.d.ts.map +1 -0
  20. package/build-types/styles/index.d.ts.map +1 -1
  21. package/build-types/styles/utils.d.ts +2 -2
  22. package/build-types/types.d.ts +3 -0
  23. package/build-types/types.d.ts.map +1 -1
  24. package/class-wp-style-engine-css-declarations.php +32 -0
  25. package/class-wp-style-engine.php +11 -0
  26. package/package.json +2 -2
  27. package/src/styles/border/index.ts +2 -2
  28. package/src/styles/dimensions/index.ts +19 -0
  29. package/src/styles/index.ts +2 -0
  30. package/src/styles/utils.ts +2 -2
  31. package/src/test/index.js +12 -1
  32. package/src/types.ts +3 -0
  33. package/tsconfig.tsbuildinfo +1 -1
  34. package/phpunit/class-wp-style-engine-css-declarations-test.php +0 -281
  35. package/phpunit/class-wp-style-engine-css-rule-test.php +0 -156
  36. package/phpunit/class-wp-style-engine-css-rules-store-test.php +0 -188
  37. package/phpunit/class-wp-style-engine-processor-test.php +0 -314
  38. package/phpunit/style-engine-test.php +0 -688
@@ -1 +1 @@
1
- {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/@types/lodash/common/common.d.ts","../../node_modules/@types/lodash/common/array.d.ts","../../node_modules/@types/lodash/common/collection.d.ts","../../node_modules/@types/lodash/common/date.d.ts","../../node_modules/@types/lodash/common/function.d.ts","../../node_modules/@types/lodash/common/lang.d.ts","../../node_modules/@types/lodash/common/math.d.ts","../../node_modules/@types/lodash/common/number.d.ts","../../node_modules/@types/lodash/common/object.d.ts","../../node_modules/@types/lodash/common/seq.d.ts","../../node_modules/@types/lodash/common/string.d.ts","../../node_modules/@types/lodash/common/util.d.ts","../../node_modules/@types/lodash/index.d.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/@types/react/node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/scheduler/tracing.d.ts","../../node_modules/@types/react/index.d.ts","./src/types.ts","./src/styles/constants.ts","./src/styles/utils.ts","./src/styles/border/index.ts","./src/styles/color/background.ts","./src/styles/color/gradient.ts","./src/styles/color/text.ts","./src/styles/color/index.ts","./src/styles/shadow/index.ts","./src/styles/outline/index.ts","./src/styles/spacing/padding.ts","./src/styles/spacing/margin.ts","./src/styles/spacing/index.ts","./src/styles/typography/index.ts","./src/styles/index.ts","./src/index.ts"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","438284c7c455a29b9c0e2d1e72abc62ee93d9a163029ffe918a34c5db3b92da2","0c75b204aed9cf6ff1c7b4bed87a3ece0d9d6fc857a6350c0c95ed0c38c814e8","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","c24ad9be9adf28f0927e3d9d9e9cec1c677022356f241ccbbfb97bfe8fb3d1a1","0ec0998e2d085e8ea54266f547976ae152c9dd6cdb9ac4d8a520a230f5ebae84","9364c7566b0be2f7b70ff5285eb34686f83ccb01bda529b82d23b2a844653bfb","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","82251920b05f30981c9a4109cb5f3169dce4b477effc845c6d781044a30e7672","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3e59f00ab03c33717b3130066d4debb272da90eeded4935ff0604c2bc25a5cae","9fa6b83a35e897f340858995ca5d77e901d89fd18644cd4c9e8a4afe0b2e6363",{"version":"0714e2046df66c0e93c3330d30dbc0565b3e8cd3ee302cf99e4ede6220e5fec8","affectsGlobalScope":true},{"version":"ecf78e637f710f340ec08d5d92b3f31b134a46a4fcf2e758690d8c46ce62cba6","affectsGlobalScope":true},"381899b8d1d4c1be716f18cb5242ba39f66f4b1e31d45af62a32a99f8edcb39d","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"1bc82f5b3bb93df76d19730c84467b0b346187198537135d63a672956f323720","affectsGlobalScope":true},"055acd3f486e8f2a4cb9d6a252b254ec0988065b222425e90258bdd3b80c2248","301543eebfdd2fc5e5d6d928c5ed3f65bd377e95d184eb1351df5fe38ef9eac0","3fc8ed5a57e9a0e6831895b3d20ae8fc6e69ded33fdd39922287867e2df6c47e","6a47ab963c0de27ca91c40b8a8370d4c368f51bbcfeb70ca028fa3679afa56f9","49dec6685c69b84a795d1e2c2a8d7ac8953efb4a7dadb9b1b04c836053e0ea21","8cbcd8c85fe3627d4c9e75ccf2784b7e4d0082396600e9d432f1cd61009a7933","f303eb9a884f47802f08d6b1d376c737856c29783532a44116bfc7e4929a7204","e8dc9f16ad89ba54f1e7202369a69a265ccd5eec0df39cf429ff1a941603d4da","51f25b3291c4ca38c72cb150453eb2961bb0ca2891102719064e2a695c47a55a","697ce73163b0e4ac9fe325a666e48b76b0754eff4b3fe7906369894a76cd860f","caa45d96bc56c4f2ea6dfbe715413636f0d8b74121a8820b70526a3ae1bfd9b9","3d0705f37a3de49d9210d2656cd697ae0cd93476a7e60f7b099797166e4d78b0","b7003bd91d5a0b8bf84a3ef07a0cf5a4b8e0cef58d9e6404f54f05fd4ed6f0b2","f663bea39fe633f8875848f18196303c24fe9d039549ae750c0d6e3bd9571032","1d74aab11e4f2e9bf4eff69b158bff07261a20cd45606cad289852365eb1c23a","32464ebe97607450c6960c489338d41d381ebe1a465b6c5b59aad285bbd64e0b"],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[45,47,48,49,50,51,52,53,54,55,56,57],[45,46,48,49,50,51,52,53,54,55,56,57],[46,47,48,49,50,51,52,53,54,55,56,57],[45,46,47,49,50,51,52,53,54,55,56,57],[45,46,47,48,50,51,52,53,54,55,56,57],[45,46,47,48,49,51,52,53,54,55,56,57],[45,46,47,48,49,50,52,53,54,55,56,57],[45,46,47,48,49,50,51,53,54,55,56,57],[45,46,47,48,49,50,51,52,54,55,56,57],[45,46,47,48,49,50,51,52,53,55,56,57],[45,46,47,48,49,50,51,52,53,54,56,57],[45,46,47,48,49,50,51,52,53,54,55,57],[45,46,47,48,49,50,51,52,53,54,55,56],[58,59,60,61],[57,63,77],[63,65],[67,68,69],[66,70,71,72,75,76],[73,74],[57,63,64],[62]],"referencedMap":[[46,1],[47,2],[45,3],[48,4],[49,5],[50,6],[51,7],[52,8],[53,9],[54,10],[55,11],[56,12],[57,13],[62,14],[78,15],[66,16],[67,16],[68,16],[70,17],[69,16],[77,18],[72,16],[71,16],[75,19],[74,16],[73,16],[76,16],[65,20],[63,21]],"exportedModulesMap":[[46,1],[47,2],[45,3],[48,4],[49,5],[50,6],[51,7],[52,8],[53,9],[54,10],[55,11],[56,12],[57,13],[62,14],[78,15],[66,16],[67,16],[68,16],[70,17],[69,16],[77,18],[72,16],[71,16],[75,19],[74,16],[73,16],[76,16],[65,20],[63,21]],"semanticDiagnosticsPerFile":[46,47,45,48,49,50,51,52,53,54,55,56,57,60,58,62,59,61,10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,78,66,67,68,70,69,64,77,72,71,75,74,73,76,65,63]},"version":"4.4.2"}
1
+ {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/@types/lodash/common/common.d.ts","../../node_modules/@types/lodash/common/array.d.ts","../../node_modules/@types/lodash/common/collection.d.ts","../../node_modules/@types/lodash/common/date.d.ts","../../node_modules/@types/lodash/common/function.d.ts","../../node_modules/@types/lodash/common/lang.d.ts","../../node_modules/@types/lodash/common/math.d.ts","../../node_modules/@types/lodash/common/number.d.ts","../../node_modules/@types/lodash/common/object.d.ts","../../node_modules/@types/lodash/common/seq.d.ts","../../node_modules/@types/lodash/common/string.d.ts","../../node_modules/@types/lodash/common/util.d.ts","../../node_modules/@types/lodash/index.d.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/@types/react/node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/scheduler/tracing.d.ts","../../node_modules/@types/react/index.d.ts","./src/types.ts","./src/styles/constants.ts","./src/styles/utils.ts","./src/styles/border/index.ts","./src/styles/color/background.ts","./src/styles/color/gradient.ts","./src/styles/color/text.ts","./src/styles/color/index.ts","./src/styles/dimensions/index.ts","./src/styles/shadow/index.ts","./src/styles/outline/index.ts","./src/styles/spacing/padding.ts","./src/styles/spacing/margin.ts","./src/styles/spacing/index.ts","./src/styles/typography/index.ts","./src/styles/index.ts","./src/index.ts"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","438284c7c455a29b9c0e2d1e72abc62ee93d9a163029ffe918a34c5db3b92da2","0c75b204aed9cf6ff1c7b4bed87a3ece0d9d6fc857a6350c0c95ed0c38c814e8","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","c24ad9be9adf28f0927e3d9d9e9cec1c677022356f241ccbbfb97bfe8fb3d1a1","0ec0998e2d085e8ea54266f547976ae152c9dd6cdb9ac4d8a520a230f5ebae84","9364c7566b0be2f7b70ff5285eb34686f83ccb01bda529b82d23b2a844653bfb","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","82251920b05f30981c9a4109cb5f3169dce4b477effc845c6d781044a30e7672","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3e59f00ab03c33717b3130066d4debb272da90eeded4935ff0604c2bc25a5cae","9fa6b83a35e897f340858995ca5d77e901d89fd18644cd4c9e8a4afe0b2e6363",{"version":"0714e2046df66c0e93c3330d30dbc0565b3e8cd3ee302cf99e4ede6220e5fec8","affectsGlobalScope":true},{"version":"ecf78e637f710f340ec08d5d92b3f31b134a46a4fcf2e758690d8c46ce62cba6","affectsGlobalScope":true},"381899b8d1d4c1be716f18cb5242ba39f66f4b1e31d45af62a32a99f8edcb39d","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"1bc82f5b3bb93df76d19730c84467b0b346187198537135d63a672956f323720","affectsGlobalScope":true},"0f2b18996e567b2798460d1dddfdb1ec9e909474fafebd8334f7c273794b6cce","301543eebfdd2fc5e5d6d928c5ed3f65bd377e95d184eb1351df5fe38ef9eac0","3b65590e54e24fe1e0739b84f0f97e8e7fb694f95d05b60d39e7647b0f89cc43","dae05e8cb74644f998ce01904e93c41949a8c6b75b5c0af75d68d3abf2779e71","49dec6685c69b84a795d1e2c2a8d7ac8953efb4a7dadb9b1b04c836053e0ea21","8cbcd8c85fe3627d4c9e75ccf2784b7e4d0082396600e9d432f1cd61009a7933","f303eb9a884f47802f08d6b1d376c737856c29783532a44116bfc7e4929a7204","e8dc9f16ad89ba54f1e7202369a69a265ccd5eec0df39cf429ff1a941603d4da","65c3ed1afd27cc04c86fafa33cb549ac39f94d828ce06f0a9b3464b05c9a05d6","51f25b3291c4ca38c72cb150453eb2961bb0ca2891102719064e2a695c47a55a","697ce73163b0e4ac9fe325a666e48b76b0754eff4b3fe7906369894a76cd860f","caa45d96bc56c4f2ea6dfbe715413636f0d8b74121a8820b70526a3ae1bfd9b9","3d0705f37a3de49d9210d2656cd697ae0cd93476a7e60f7b099797166e4d78b0","b7003bd91d5a0b8bf84a3ef07a0cf5a4b8e0cef58d9e6404f54f05fd4ed6f0b2","f663bea39fe633f8875848f18196303c24fe9d039549ae750c0d6e3bd9571032","fb22bd47aad5bb07bd4a88908ff4a3a02af74c3f7f3a56a76ed43ba80cea82e4","32464ebe97607450c6960c489338d41d381ebe1a465b6c5b59aad285bbd64e0b"],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[45,47,48,49,50,51,52,53,54,55,56,57],[45,46,48,49,50,51,52,53,54,55,56,57],[46,47,48,49,50,51,52,53,54,55,56,57],[45,46,47,49,50,51,52,53,54,55,56,57],[45,46,47,48,50,51,52,53,54,55,56,57],[45,46,47,48,49,51,52,53,54,55,56,57],[45,46,47,48,49,50,52,53,54,55,56,57],[45,46,47,48,49,50,51,53,54,55,56,57],[45,46,47,48,49,50,51,52,54,55,56,57],[45,46,47,48,49,50,51,52,53,55,56,57],[45,46,47,48,49,50,51,52,53,54,56,57],[45,46,47,48,49,50,51,52,53,54,55,57],[45,46,47,48,49,50,51,52,53,54,55,56],[58,59,60,61],[57,63,78],[63,65],[67,68,69],[66,70,71,72,73,76,77],[74,75],[57,63,64],[62]],"referencedMap":[[46,1],[47,2],[45,3],[48,4],[49,5],[50,6],[51,7],[52,8],[53,9],[54,10],[55,11],[56,12],[57,13],[62,14],[79,15],[66,16],[67,16],[68,16],[70,17],[69,16],[71,16],[78,18],[73,16],[72,16],[76,19],[75,16],[74,16],[77,16],[65,20],[63,21]],"exportedModulesMap":[[46,1],[47,2],[45,3],[48,4],[49,5],[50,6],[51,7],[52,8],[53,9],[54,10],[55,11],[56,12],[57,13],[62,14],[79,15],[66,16],[67,16],[68,16],[70,17],[69,16],[71,16],[78,18],[73,16],[72,16],[76,19],[75,16],[74,16],[77,16],[65,20],[63,21]],"semanticDiagnosticsPerFile":[46,47,45,48,49,50,51,52,53,54,55,56,57,60,58,62,59,61,10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,79,66,67,68,70,69,64,71,78,73,72,76,75,74,77,65,63]},"version":"4.4.2"}
@@ -1,281 +0,0 @@
1
- <?php
2
- /**
3
- * Tests the Style Engine CSS declarations class.
4
- *
5
- * @package Gutenberg
6
- * @subpackage style-engine
7
- */
8
-
9
- // Check for the existence of Style Engine classes and methods.
10
- // Once the Style Engine has been migrated to Core we can remove the if statements and require imports.
11
- // Testing new features from the Gutenberg package may require
12
- // testing against `gutenberg_` and `_Gutenberg` functions and methods in the future.
13
- if ( ! class_exists( 'WP_Style_Engine_CSS_Declarations' ) ) {
14
- require __DIR__ . '/../class-wp-style-engine-css-declarations.php';
15
- }
16
-
17
- /**
18
- * Tests registering, storing and generating CSS declarations.
19
- *
20
- * @coversDefaultClass WP_Style_Engine_CSS_Declarations
21
- */
22
- class WP_Style_Engine_CSS_Declarations_Test extends WP_UnitTestCase {
23
- /**
24
- * Tests setting declarations on instantiation.
25
- *
26
- * @covers ::__construct
27
- */
28
- public function test_should_instantiate_with_declarations() {
29
- $input_declarations = array(
30
- 'margin-top' => '10px',
31
- 'font-size' => '2rem',
32
- );
33
- $css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );
34
- $this->assertSame( $input_declarations, $css_declarations->get_declarations() );
35
- }
36
-
37
- /**
38
- * Tests that declarations are added.
39
- *
40
- * @covers ::add_declarations
41
- * @covers ::add_declaration
42
- */
43
- public function test_should_add_declarations() {
44
- $input_declarations = array(
45
- 'padding' => '20px',
46
- 'color' => 'var(--wp--preset--elbow-patches)',
47
- );
48
- $css_declarations = new WP_Style_Engine_CSS_Declarations();
49
- $css_declarations->add_declarations( $input_declarations );
50
-
51
- $this->assertSame( $input_declarations, $css_declarations->get_declarations() );
52
- }
53
-
54
- /**
55
- * Tests that new declarations are added to existing declarations.
56
- *
57
- * @covers ::add_declarations
58
- * @covers ::add_declaration
59
- */
60
- public function test_should_add_new_declarations_to_existing() {
61
- $input_declarations = array(
62
- 'border-width' => '1%',
63
- 'background-color' => 'var(--wp--preset--english-mustard)',
64
- );
65
- $css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );
66
- $extra_declaration = array(
67
- 'letter-spacing' => '1.5px',
68
- );
69
- $css_declarations->add_declarations( $extra_declaration );
70
-
71
- $this->assertSame( array_merge( $input_declarations, $extra_declaration ), $css_declarations->get_declarations() );
72
- }
73
-
74
- /**
75
- * Tests that properties are sanitized before storing.
76
- *
77
- * @covers ::filter_declaration
78
- * @covers ::sanitize_property
79
- */
80
- public function test_should_sanitize_properties() {
81
- $input_declarations = array(
82
- '^--wp--style--sleepy-potato$' => '40px',
83
- '<background-//color>' => 'var(--wp--preset--english-mustard)',
84
- );
85
- $css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );
86
-
87
- $this->assertSame(
88
- array(
89
- '--wp--style--sleepy-potato' => '40px',
90
- 'background-color' => 'var(--wp--preset--english-mustard)',
91
- ),
92
- $css_declarations->get_declarations()
93
- );
94
- }
95
-
96
- /**
97
- * Tests that values with HTML tags are escaped, and CSS properties are run through safecss_filter_attr().
98
- *
99
- * @covers ::get_declarations_string
100
- * @covers ::filter_declaration
101
- */
102
- public function test_should_strip_html_tags_and_remove_unsafe_css_properties() {
103
- $input_declarations = array(
104
- 'font-size' => '<red/>',
105
- 'padding' => '</style>',
106
- 'potato' => 'uppercase',
107
- 'cheese' => '10px',
108
- 'margin-right' => '10em',
109
- );
110
- $css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );
111
- $safe_style_css_mock_action = new MockAction();
112
-
113
- // filter_declaration() is called in get_declarations_string().
114
- add_filter( 'safe_style_css', array( $safe_style_css_mock_action, 'filter' ) );
115
- $css_declarations_string = $css_declarations->get_declarations_string();
116
-
117
- $this->assertSame(
118
- 3, // Values with HTML tags are removed first by wp_strip_all_tags().
119
- $safe_style_css_mock_action->get_call_count(),
120
- '"safe_style_css" filters were not applied to CSS declaration properties.'
121
- );
122
-
123
- $this->assertSame(
124
- 'margin-right:10em;',
125
- $css_declarations_string,
126
- 'Unallowed CSS properties or values with HTML tags were not removed.'
127
- );
128
- }
129
-
130
-
131
- /**
132
- * Tests that calc, clamp, min, max, and minmax CSS functions are allowed.
133
- *
134
- * @covers ::get_declarations_string
135
- * @covers ::filter_declaration
136
- */
137
- public function test_should_allow_css_functions_and_strip_unsafe_css_values() {
138
- $input_declarations = array(
139
- 'background' => 'var(--wp--preset--color--primary, 10px)', // Simple var().
140
- 'font-size' => 'clamp(36.00rem, calc(32.00rem + 10.00vw), 40.00rem)', // Nested clamp().
141
- 'width' => 'min(150vw, 100px)',
142
- 'min-width' => 'max(150vw, 100px)',
143
- 'max-width' => 'minmax(400px, 50%)',
144
- 'padding' => 'calc(80px * -1)',
145
- 'background-image' => 'url("https://wordpress.org")',
146
- 'line-height' => 'url("https://wordpress.org")',
147
- 'margin' => 'illegalfunction(30px)',
148
- );
149
- $css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );
150
- $safecss_filter_attr_allow_css_mock_action = new MockAction();
151
-
152
- // filter_declaration() is called in get_declarations_string().
153
- add_filter( 'safecss_filter_attr_allow_css', array( $safecss_filter_attr_allow_css_mock_action, 'filter' ) );
154
- $css_declarations_string = $css_declarations->get_declarations_string();
155
-
156
- $this->assertSame(
157
- 9,
158
- $safecss_filter_attr_allow_css_mock_action->get_call_count(),
159
- '"safecss_filter_attr_allow_css" filters were not applied to CSS declaration values.'
160
- );
161
-
162
- $this->assertSame(
163
- 'background:var(--wp--preset--color--primary, 10px);font-size:clamp(36.00rem, calc(32.00rem + 10.00vw), 40.00rem);width:min(150vw, 100px);min-width:max(150vw, 100px);max-width:minmax(400px, 50%);padding:calc(80px * -1);background-image:url("https://wordpress.org");',
164
- $css_declarations_string,
165
- 'Unsafe values were not removed'
166
- );
167
- }
168
-
169
- /**
170
- * Tests that CSS declarations are compiled into a CSS declarations block string.
171
- *
172
- * @covers ::get_declarations_string
173
- *
174
- * @dataProvider data_should_compile_css_declarations_to_css_declarations_string
175
- *
176
- * @param string $expected The expected declarations block string.
177
- * @param bool $should_prettify Optional. Whether to pretty the string. Default false.
178
- * @param int $indent_count Optional. The number of tab indents. Default false.
179
- */
180
- public function test_should_compile_css_declarations_to_css_declarations_string( $expected, $should_prettify = false, $indent_count = 0 ) {
181
- $input_declarations = array(
182
- 'color' => 'red',
183
- 'border-top-left-radius' => '99px',
184
- 'text-decoration' => 'underline',
185
- );
186
- $css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );
187
-
188
- $this->assertSame(
189
- $expected,
190
- $css_declarations->get_declarations_string( $should_prettify, $indent_count )
191
- );
192
- }
193
-
194
- /**
195
- * Data provider for test_should_compile_css_declarations_to_css_declarations_string().
196
- *
197
- * @return array
198
- */
199
- public function data_should_compile_css_declarations_to_css_declarations_string() {
200
- return array(
201
- 'unprettified, no indent' => array(
202
- 'expected' => 'color:red;border-top-left-radius:99px;text-decoration:underline;',
203
- ),
204
- 'unprettified, one indent' => array(
205
- 'expected' => 'color:red;border-top-left-radius:99px;text-decoration:underline;',
206
- 'should_prettify' => false,
207
- 'indent_count' => 1,
208
- ),
209
- 'prettified, no indent' => array(
210
- 'expected' => 'color: red; border-top-left-radius: 99px; text-decoration: underline;',
211
- 'should_prettify' => true,
212
- ),
213
- 'prettified, one indent' => array(
214
- 'expected' => "\tcolor: red;\n\tborder-top-left-radius: 99px;\n\ttext-decoration: underline;",
215
- 'should_prettify' => true,
216
- 'indent_count' => 1,
217
- ),
218
- 'prettified, two indents' => array(
219
- 'expected' => "\t\tcolor: red;\n\t\tborder-top-left-radius: 99px;\n\t\ttext-decoration: underline;",
220
- 'should_prettify' => true,
221
- 'indent_count' => 2,
222
- ),
223
- );
224
- }
225
-
226
- /**
227
- * Tests removing a single declaration.
228
- *
229
- * @covers ::remove_declaration
230
- */
231
- public function test_should_remove_single_declaration() {
232
- $input_declarations = array(
233
- 'color' => 'tomato',
234
- 'margin' => '10em 10em 20em 1px',
235
- 'font-family' => 'Happy Font serif',
236
- );
237
- $css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );
238
-
239
- $this->assertSame(
240
- 'color:tomato;margin:10em 10em 20em 1px;font-family:Happy Font serif;',
241
- $css_declarations->get_declarations_string(),
242
- 'CSS declarations string does not match the values of `$declarations` passed to the constructor.'
243
- );
244
-
245
- $css_declarations->remove_declaration( 'color' );
246
-
247
- $this->assertSame(
248
- 'margin:10em 10em 20em 1px;font-family:Happy Font serif;',
249
- $css_declarations->get_declarations_string(),
250
- 'Output after removing "color" declaration via `remove_declaration()` does not match expectations'
251
- );
252
- }
253
-
254
- /**
255
- * Tests that multiple declarations are removed.
256
- *
257
- * @covers ::remove_declarations
258
- */
259
- public function test_should_remove_multiple_declarations() {
260
- $input_declarations = array(
261
- 'color' => 'cucumber',
262
- 'margin' => '10em 10em 20em 1px',
263
- 'font-family' => 'Happy Font serif',
264
- );
265
- $css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );
266
-
267
- $this->assertSame(
268
- 'color:cucumber;margin:10em 10em 20em 1px;font-family:Happy Font serif;',
269
- $css_declarations->get_declarations_string(),
270
- 'CSS declarations string does not match the values of `$declarations` passed to the constructor.'
271
- );
272
-
273
- $css_declarations->remove_declarations( array( 'color', 'margin' ) );
274
-
275
- $this->assertSame(
276
- 'font-family:Happy Font serif;',
277
- $css_declarations->get_declarations_string(),
278
- 'Output after removing "color" and "margin" declarations via `remove_declarations()` does not match expectations'
279
- );
280
- }
281
- }
@@ -1,156 +0,0 @@
1
- <?php
2
- /**
3
- * Tests the Style Engine CSS Rule class.
4
- *
5
- * @package Gutenberg
6
- * @subpackage style-engine
7
- */
8
-
9
- // Check for the existence of Style Engine classes and methods.
10
- // Once the Style Engine has been migrated to Core we can remove the if statements and require imports.
11
- // Testing new features from the Gutenberg package may require
12
- // testing against `gutenberg_` and `_Gutenberg` functions and methods in the future.
13
- if ( ! class_exists( 'WP_Style_Engine_CSS_Declarations' ) ) {
14
- require __DIR__ . '/../class-wp-style-engine-css-declarations.php';
15
- }
16
-
17
- if ( ! class_exists( 'WP_Style_Engine_CSS_Rule' ) ) {
18
- require __DIR__ . '/../class-wp-style-engine-css-rule.php';
19
- }
20
-
21
- /**
22
- * Tests for registering, storing and generating CSS rules.
23
- *
24
- * @coversDefaultClass WP_Style_Engine_CSS_Rule
25
- */
26
- class WP_Style_Engine_CSS_Rule_Test extends WP_UnitTestCase {
27
- /**
28
- * Tests that declarations are set on instantiation.
29
- *
30
- * @covers ::__construct
31
- */
32
- public function test_should_instantiate_with_selector_and_rules() {
33
- $selector = '.law-and-order';
34
- $input_declarations = array(
35
- 'margin-top' => '10px',
36
- 'font-size' => '2rem',
37
- );
38
- $css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );
39
- $css_rule = new WP_Style_Engine_CSS_Rule( $selector, $css_declarations );
40
-
41
- $this->assertSame( $selector, $css_rule->get_selector(), 'Return value of get_selector() does not match value passed to constructor.' );
42
-
43
- $expected = "$selector{{$css_declarations->get_declarations_string()}}";
44
-
45
- $this->assertSame( $expected, $css_rule->get_css(), 'Value returned by get_css() does not match expected declarations string.' );
46
- }
47
-
48
- /**
49
- * Tests that declaration properties are deduplicated.
50
- *
51
- * @covers ::add_declarations
52
- * @covers ::get_css
53
- */
54
- public function test_should_dedupe_properties_in_rules() {
55
- $selector = '.taggart';
56
- $first_declaration = array(
57
- 'font-size' => '2rem',
58
- );
59
- $overwrite_first_declaration = array(
60
- 'font-size' => '4px',
61
- );
62
- $css_rule = new WP_Style_Engine_CSS_Rule( $selector, $first_declaration );
63
- $css_rule->add_declarations( new WP_Style_Engine_CSS_Declarations( $overwrite_first_declaration ) );
64
-
65
- $expected = '.taggart{font-size:4px;}';
66
- $this->assertSame( $expected, $css_rule->get_css() );
67
- }
68
-
69
- /**
70
- * Tests that declarations can be added to existing rules.
71
- *
72
- * @covers ::add_declarations
73
- * @covers ::get_css
74
- */
75
- public function test_should_add_declarations_to_existing_rules() {
76
- // Declarations using a WP_Style_Engine_CSS_Declarations object.
77
- $some_css_declarations = new WP_Style_Engine_CSS_Declarations( array( 'margin-top' => '10px' ) );
78
- // Declarations using a property => value array.
79
- $some_more_css_declarations = array( 'font-size' => '1rem' );
80
- $css_rule = new WP_Style_Engine_CSS_Rule( '.hill-street-blues', $some_css_declarations );
81
- $css_rule->add_declarations( $some_more_css_declarations );
82
-
83
- $expected = '.hill-street-blues{margin-top:10px;font-size:1rem;}';
84
-
85
- $this->assertSame( $expected, $css_rule->get_css() );
86
- }
87
-
88
- /**
89
- * Tests setting a selector to a rule.
90
- *
91
- * @covers ::set_selector
92
- */
93
- public function test_should_set_selector() {
94
- $selector = '.taggart';
95
- $css_rule = new WP_Style_Engine_CSS_Rule( $selector );
96
-
97
- $this->assertSame( $selector, $css_rule->get_selector(), 'Return value of get_selector() does not match value passed to constructor.' );
98
-
99
- $css_rule->set_selector( '.law-and-order' );
100
-
101
- $this->assertSame( '.law-and-order', $css_rule->get_selector(), 'Return value of get_selector() does not match value passed to set_selector().' );
102
- }
103
-
104
- /**
105
- * Tests generating a CSS rule string.
106
- *
107
- * @covers ::get_css
108
- */
109
- public function test_should_generate_css_rule_string() {
110
- $selector = '.chips';
111
- $input_declarations = array(
112
- 'margin-top' => '10px',
113
- 'font-size' => '2rem',
114
- );
115
- $css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );
116
- $css_rule = new WP_Style_Engine_CSS_Rule( $selector, $css_declarations );
117
- $expected = "$selector{{$css_declarations->get_declarations_string()}}";
118
-
119
- $this->assertSame( $expected, $css_rule->get_css() );
120
- }
121
-
122
- /**
123
- * Tests that an empty string will be returned where there are no declarations in a CSS rule.
124
- *
125
- * @covers ::get_css
126
- */
127
- public function test_should_return_empty_string_with_no_declarations() {
128
- $selector = '.holmes';
129
- $input_declarations = array();
130
- $css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );
131
- $css_rule = new WP_Style_Engine_CSS_Rule( $selector, $css_declarations );
132
-
133
- $this->assertSame( '', $css_rule->get_css() );
134
- }
135
-
136
- /**
137
- * Tests that CSS rules are prettified.
138
- *
139
- * @covers ::get_css
140
- */
141
- public function test_should_prettify_css_rule_output() {
142
- $selector = '.baptiste';
143
- $input_declarations = array(
144
- 'margin-left' => '0',
145
- 'font-family' => 'Detective Sans',
146
- );
147
- $css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );
148
- $css_rule = new WP_Style_Engine_CSS_Rule( $selector, $css_declarations );
149
- $expected = '.baptiste {
150
- margin-left: 0;
151
- font-family: Detective Sans;
152
- }';
153
-
154
- $this->assertSame( $expected, $css_rule->get_css( true ) );
155
- }
156
- }