Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(postcss-reduce-initial): update list of properties values #1564

Merged
merged 2 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tough-starfishes-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"postcss-reduce-initial": patch
---

fix(postcss-reduce-initial): update initial property list
1 change: 0 additions & 1 deletion packages/postcss-reduce-initial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"devDependencies": {
"@types/caniuse-api": "^3.0.6",
"html-to-text": "^9.0.5",
"nanospy": "^1.0.0",
"postcss": "^8.4.35"
},
"peerDependencies": {
Expand Down
14 changes: 7 additions & 7 deletions packages/postcss-reduce-initial/script/test/io.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs';
import { test } from 'uvu';
import * as assert from 'uvu/assert';
import { spy } from 'nanospy';
import { mock } from 'node:test';
import { handleError, toJSONString, write, generate } from '../lib/io.mjs';

const testData = JSON.parse(
Expand Down Expand Up @@ -31,10 +31,10 @@ for (const [key, path, expected] of [
['toInitial', paths.toInitial, data.toInitial],
]) {
test(`should write JSON file based on key ${key}`, () => {
const fileFunc = spy();
const fileFunc = mock.fn();
write(fileFunc, paths, data, key);
assert.is(fileFunc.calls[0][0], path);
assert.is(fileFunc.calls[0][1], toJSONString(expected));
assert.is(fileFunc.mock.calls[0].arguments[0], path);
assert.is(fileFunc.mock.calls[0].arguments[1], toJSONString(expected));
});
}

Expand All @@ -44,8 +44,8 @@ test('should handle file operation errors', () => {
});

test('should make it through promise chain with sample data and write 2 files', async () => {
const fileFunc = spy();
const fetchFunc = spy(async () => {
const fileFunc = mock.fn();
const fetchFunc = mock.fn(async () => {
return { json: () => Promise.resolve(testData) };
});
await generate(
Expand All @@ -55,7 +55,7 @@ test('should make it through promise chain with sample data and write 2 files',
'https://example.com/properties.json'
);

assert.is(fileFunc.callCount, 2);
assert.is(fileFunc.mock.calls.length, 2);
});

test.run();
7 changes: 2 additions & 5 deletions packages/postcss-reduce-initial/src/data/fromInitial.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"-webkit-line-clamp": "none",
"accent-color": "auto",
"align-content": "normal",
"align-items": "normal",
Expand All @@ -26,7 +25,6 @@
"background-position-x": "0%",
"background-position-y": "0%",
"background-repeat": "repeat",
"block-overflow": "clip",
"block-size": "auto",
"border-block-style": "none",
"border-block-width": "medium",
Expand Down Expand Up @@ -182,7 +180,7 @@
"mask-border-width": "auto",
"mask-composite": "add",
"mask-image": "none",
"mask-position": "center",
"mask-position": "0% 0%",
"mask-repeat": "repeat",
"mask-size": "auto",
"masonry-auto-flow": "pack",
Expand All @@ -203,7 +201,7 @@
"offset-anchor": "auto",
"offset-distance": "0",
"offset-path": "none",
"offset-position": "auto",
"offset-position": "normal",
"offset-rotate": "auto",
"opacity": "1",
"order": "0",
Expand Down Expand Up @@ -313,7 +311,6 @@
"view-timeline-name": "none",
"view-transition-name": "none",
"white-space": "normal",
"white-space-trim": "none",
"widows": "2",
"width": "auto",
"will-change": "auto",
Expand Down
7 changes: 7 additions & 0 deletions packages/postcss-reduce-initial/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ test(
/* Skip transform-box for browser compatibility */
test('preserve transform-box', passthroughCSS('div{transform-box:view-box}'));

/* Most browsers do not support 'none' at present */
test(
'should preserve initial -webkit-line-clamp',
passthroughCSS('a{-webkit-line-clamp: initial;}')
);

test(
'should ignore the data present in the ignore options',
passthroughCSS('h1{min-height:initial}', { ignore: ['min-height'] })
Expand All @@ -141,4 +147,5 @@ test(
'should ignore the data present in the ignore options , toInitial #3',
passthroughCSS('WRITING-MODE:horizontal-tb', { ignore: ['writing-mode'] })
);

test.run();
8 changes: 0 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading