From 51adba51cf684079c8d1f5219be7cda818796c2f Mon Sep 17 00:00:00 2001 From: Nizar Date: Tue, 19 Mar 2024 21:05:23 +0400 Subject: [PATCH 1/2] Add css_engine input test --- .github/workflows/test.yml | 42 +++++++++ tests/css_engine/clean-css/main.expected.css | 0 tests/css_engine/lightning/main.expected.css | 0 tests/css_engine/main.css | 95 ++++++++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 tests/css_engine/clean-css/main.expected.css create mode 100644 tests/css_engine/lightning/main.expected.css create mode 100644 tests/css_engine/main.css diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8df1167..3dea44c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -136,3 +136,45 @@ jobs: git diff --exit-code --no-index \ tests/js_engine/uglify-js/main.expected.js \ tests/js_engine/uglify-js/main.min.js + + css_engine_lightning: + name: "css_engine / lightning" + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Test css_engine lightning + uses: ./ + with: + directory: "tests/css_engine" + output: "tests/css_engine/lightning" + css_engine: "lightning" + + - name: Assert css_engine lightning result matches expected + run: | + git diff --exit-code --no-index \ + tests/css_engine/lightning/main.expected.css \ + tests/css_engine/lightning/main.min.css + + css_engine_clean_css: + name: "css_engine / clean-css" + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Test css_engine clean-css + uses: ./ + with: + directory: "tests/css_engine" + output: "tests/css_engine/clean-css" + css_engine: "clean-css" + + - name: Assert css_engine clean-css result matches expected + run: | + git diff --exit-code --no-index \ + tests/css_engine/clean-css/main.expected.css \ + tests/css_engine/clean-css/main.min.css diff --git a/tests/css_engine/clean-css/main.expected.css b/tests/css_engine/clean-css/main.expected.css new file mode 100644 index 0000000..e69de29 diff --git a/tests/css_engine/lightning/main.expected.css b/tests/css_engine/lightning/main.expected.css new file mode 100644 index 0000000..e69de29 diff --git a/tests/css_engine/main.css b/tests/css_engine/main.css new file mode 100644 index 0000000..7caf160 --- /dev/null +++ b/tests/css_engine/main.css @@ -0,0 +1,95 @@ +/* Example CSS file for minification testing */ + +/* Basic styling */ +body { + font-family: 'Arial', sans-serif; + margin: 0; + padding: 0; + background-color: #f4f4f4; +} + +h1, h2, h3 { + color: #333; +} + +p { + color: #666; + line-height: 1.5; +} + +/* Class selector */ +.container { + width: 80%; + margin: auto; + overflow: hidden; +} + +/* ID selector */ +#main-header { + background-color: #333; + color: #fff; + padding: 20px; +} + +/* Hover pseudo-class */ +a:hover { + color: #0099cc; +} + +/* Animation */ +@keyframes slideIn { + from { + transform: translateX(-100%); + } + to { + transform: translateX(0); + } +} + +.animated-slide-in { + animation: slideIn 1s ease-out; +} + +/* Media query */ +@media (max-width: 600px) { + .container { + width: 100%; + } +} + +/* Nested selectors */ +.nav ul { + list-style: none; + background-color: #333; +} + +.nav ul li { + display: inline; + margin-right: 5px; +} + +.nav ul li a { + text-decoration: none; + color: #fff; + padding: 5px 10px; + background-color: #333; +} + +/* Attribute selector */ +input[type="text"] { + border: 1px solid #ccc; + padding: 10px; +} + +/* Pseudo-element */ +.button::before { + content: '>>'; + margin-right: 5px; +} + +/* Issue #27 */ +ul > li:not(.class ul > li, .another-class ul > li) { + display: none; +} + +/* End of file */ From ecb695df6afa22cb754979bbd5241df6781d6c49 Mon Sep 17 00:00:00 2001 From: Nizar Date: Tue, 19 Mar 2024 21:11:34 +0400 Subject: [PATCH 2/2] Add expected css files --- tests/css_engine/clean-css/main.expected.css | 1 + tests/css_engine/lightning/main.expected.css | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/css_engine/clean-css/main.expected.css b/tests/css_engine/clean-css/main.expected.css index e69de29..9aa0d25 100644 --- a/tests/css_engine/clean-css/main.expected.css +++ b/tests/css_engine/clean-css/main.expected.css @@ -0,0 +1 @@ +body{font-family:Arial,sans-serif;margin:0;padding:0;background-color:#f4f4f4}h1,h2,h3{color:#333}p{color:#666;line-height:1.5}.container{width:80%;margin:auto;overflow:hidden}#main-header{background-color:#333;color:#fff;padding:20px}a:hover{color:#09c}@keyframes slideIn{from{transform:translateX(-100%)}to{transform:translateX(0)}}.animated-slide-in{animation:slideIn 1s ease-out}@media (max-width:600px){.container{width:100%}}.nav ul{list-style:none;background-color:#333}.nav ul li{display:inline;margin-right:5px}.nav ul li a{text-decoration:none;color:#fff;padding:5px 10px;background-color:#333}input[type=text]{border:1px solid #ccc;padding:10px}.button::before{content:'>>';margin-right:5px}ul>li:not(.class ul>li,.another-class ul>li){display:none} \ No newline at end of file diff --git a/tests/css_engine/lightning/main.expected.css b/tests/css_engine/lightning/main.expected.css index e69de29..cbdfebe 100644 --- a/tests/css_engine/lightning/main.expected.css +++ b/tests/css_engine/lightning/main.expected.css @@ -0,0 +1 @@ +body{background-color:#f4f4f4;margin:0;padding:0;font-family:Arial,sans-serif}h1,h2,h3{color:#333}p{color:#666;line-height:1.5}.container{width:80%;margin:auto;overflow:hidden}#main-header{color:#fff;background-color:#333;padding:20px}a:hover{color:#09c}@keyframes slideIn{0%{transform:translate(-100%)}to{transform:translate(0)}}.animated-slide-in{animation:1s ease-out slideIn}@media (width<=600px){.container{width:100%}}.nav ul{background-color:#333;list-style:none}.nav ul li{margin-right:5px;display:inline}.nav ul li a{color:#fff;background-color:#333;padding:5px 10px;text-decoration:none}input[type=text]{border:1px solid #ccc;padding:10px}.button:before{content:">>";margin-right:5px}ul>li:not(.class ul>li,.another-class ul>li){display:none} \ No newline at end of file