This is an automated email from the ASF dual-hosted git repository. benw pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tapestry-5.git
The following commit(s) were added to refs/heads/master by this push: new 14098e6f7 TAP5-2708: simplified CssCompressorSpec, added test for TAP5-2600 14098e6f7 is described below commit 14098e6f772fd211a590247b6c8a9af8b622fc7d Author: Ben Weidig <b...@netzgut.net> AuthorDate: Sat Jun 24 13:44:30 2023 +0200 TAP5-2708: simplified CssCompressorSpec, added test for TAP5-2600 --- .../t5/webresources/tests/CssCompressorSpec.groovy | 53 +++++++++------------- .../resources/t5/webresources/css/TAP5-2524.css | 4 ++ .../t5/webresources/css/TAP5-2524.css.min | 1 + .../resources/t5/webresources/css/TAP5-2600.css | 4 ++ .../t5/webresources/css/TAP5-2600.css.min | 1 + .../css/{tap5-2753.css => TAP5-2753.css} | 0 .../css/{tap5-2753.css.min => TAP5-2753.css.min} | 0 7 files changed, 31 insertions(+), 32 deletions(-) diff --git a/tapestry-webresources/src/test/groovy/t5/webresources/tests/CssCompressorSpec.groovy b/tapestry-webresources/src/test/groovy/t5/webresources/tests/CssCompressorSpec.groovy index 096a5371b..85d7e655f 100644 --- a/tapestry-webresources/src/test/groovy/t5/webresources/tests/CssCompressorSpec.groovy +++ b/tapestry-webresources/src/test/groovy/t5/webresources/tests/CssCompressorSpec.groovy @@ -7,48 +7,37 @@ import spock.lang.Specification; class CssCompressorSpec extends Specification { - @Issue('TAP5-2524') - def "minify CSS with keyframes "() { + // To add a new CssCompressor test, add a file named after the issue + // in tapestry-webresources/src/test/resources/t5/webresources/css/ in the format: + // + // * <#basename>.css + // * <#basename>.css.min + // + // Add the issue to the "where:" clause in the test below with a sensible description. + + def "#basename: #description"() { given: - def css = '''@keyframes anim { - 0% { opacity: 0; } - 100% { opacity: 1; } -}''' - def expected = "@keyframes anim{0%{opacity:0}100%{opacity:1}}" - - when: - def result = CssCompressor.compress(css) - - then: - result == expected - } - - @Issue('TAP5-2753') - def "preserve space for calc operators"() { - given: - def is = CssCompressorSpec.class.getResourceAsStream("/t5/webresources/css/tap5-2753.css") - def t = CssCompressorSpec.class.getResourceAsStream("/t5/webresources/css/tap5-2753.css.min").text - def expected = CssCompressorSpec.class.getResourceAsStream("/t5/webresources/css/tap5-2753.css.min").text.trim() + def is = CssCompressorSpec.class.getResourceAsStream("/t5/webresources/css/${basename}.css") + def expected = CssCompressorSpec.class.getResourceAsStream("/t5/webresources/css/${basename}.css.min").text.trim() when: def result = CssCompressor.compress(is) then: result == expected - } - def "bootstrap.css integry check"() { - given: - def is = CssCompressorSpec.class.getResourceAsStream("/t5/webresources/css/bootstrap.css") - def expected = CssCompressorSpec.class.getResourceAsStream("/t5/webresources/css/bootstrap.css.min").text.trim() - - when: - def result = CssCompressor.compress(is) - - then: - result == expected + where: + basename | description + 'bootstrap' | 'bootstrap minification integrity check' + 'TAP5-2524' | 'minify CSS with keyframes' + 'TAP5-2600' | 'preserve 0s in transition' + 'TAP5-2753' | 'preserve space for calc operators' } + /** + * These tests were moved over from https://github.com/yui/yuicompressor to ensure that the + * CssCompressor behaves as identical as possible after any modifications. + */ def "yui compressor test '#rawFile'"() { given: def is = CssCompressorSpec.class.getResourceAsStream("/t5/webresources/css/yui/$rawFile") diff --git a/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2524.css b/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2524.css new file mode 100644 index 000000000..64f770f18 --- /dev/null +++ b/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2524.css @@ -0,0 +1,4 @@ +@keyframes anim { + 0% { opacity: 0; } + 100% { opacity: 1; } +} \ No newline at end of file diff --git a/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2524.css.min b/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2524.css.min new file mode 100644 index 000000000..4c4c5b3cb --- /dev/null +++ b/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2524.css.min @@ -0,0 +1 @@ +@keyframes anim{0%{opacity:0}100%{opacity:1}} \ No newline at end of file diff --git a/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2600.css b/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2600.css new file mode 100644 index 000000000..78e31efdb --- /dev/null +++ b/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2600.css @@ -0,0 +1,4 @@ +.some-class +{ + transition: all 500ms ease 0s; +} \ No newline at end of file diff --git a/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2600.css.min b/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2600.css.min new file mode 100644 index 000000000..1dda712d8 --- /dev/null +++ b/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2600.css.min @@ -0,0 +1 @@ +.some-class{transition:all 500ms ease 0s} \ No newline at end of file diff --git a/tapestry-webresources/src/test/resources/t5/webresources/css/tap5-2753.css b/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2753.css similarity index 100% rename from tapestry-webresources/src/test/resources/t5/webresources/css/tap5-2753.css rename to tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2753.css diff --git a/tapestry-webresources/src/test/resources/t5/webresources/css/tap5-2753.css.min b/tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2753.css.min similarity index 100% rename from tapestry-webresources/src/test/resources/t5/webresources/css/tap5-2753.css.min rename to tapestry-webresources/src/test/resources/t5/webresources/css/TAP5-2753.css.min