From 51adba51cf684079c8d1f5219be7cda818796c2f Mon Sep 17 00:00:00 2001 From: Nizar Date: Tue, 19 Mar 2024 21:05:23 +0400 Subject: [PATCH] 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 */