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

feat: support justify-content, align-items, align-self, align-content properties #628

Merged
merged 5 commits into from
Apr 1, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* eslint-disable sort/object-properties */
import { stripIndent } from 'common-tags';
import { getTestRule } from 'jest-preset-stylelint';

import { messages, plugin, ruleName } from '~/rule';

const testRule = getTestRule({
plugins: [plugin],
});

testRule({
ruleName,
config: [
true,
{
allow: {
features: [
'properties.align-content',
'properties.align-content.flex_context.first_baseline',
'properties.align-content.flex_context.last_baseline',
],
},
browserslist: 'chrome 20',
},
],
reject: [
{
code: stripIndent`
#id {
align-content: baseline;
}
`,
line: 2,
column: 18,
endLine: 2,
endColumn: 26,
message: messages.rejected('"baseline" value specified as align-content', 'Chrome 20', ''),
},
{
code: stripIndent`
#id {
align-content: first baseline;
}
`,
line: 2,
column: 24,
endLine: 2,
endColumn: 32,
message: messages.rejected('"baseline" value specified as align-content', 'Chrome 20', ''),
},
{
code: stripIndent`
#id {
align-content: last baseline;
}
`,
line: 2,
column: 23,
endLine: 2,
endColumn: 31,
message: messages.rejected('"baseline" value specified as align-content', 'Chrome 20', ''),
},
],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable sort/object-properties */
import { stripIndent } from 'common-tags';
import { getTestRule } from 'jest-preset-stylelint';

import { messages, plugin, ruleName } from '~/rule';

const testRule = getTestRule({
plugins: [plugin],
});

testRule({
ruleName,
config: [
true,
{
browserslist: 'chrome 58',
},
],
reject: [
{
code: stripIndent`
#id {
align-content: first baseline;
}
`,
line: 2,
column: 18,
endLine: 2,
endColumn: 32,
message: messages.rejected('"first baseline" value specified as align-content', 'Chrome 58', ''),
},
],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable sort/object-properties */
import { stripIndent } from 'common-tags';
import { getTestRule } from 'jest-preset-stylelint';

import { messages, plugin, ruleName } from '~/rule';

const testRule = getTestRule({
plugins: [plugin],
});

testRule({
ruleName,
config: [
true,
{
browserslist: 'chrome 107',
},
],
reject: [
{
code: stripIndent`
#id {
align-content: last baseline;
}
`,
line: 2,
column: 18,
endLine: 2,
endColumn: 31,
message: messages.rejected('"last baseline" value specified as align-content', 'Chrome 107', ''),
},
],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* eslint-disable sort/object-properties */
import { stripIndent } from 'common-tags';
import { getTestRule } from 'jest-preset-stylelint';

import { messages, plugin, ruleName } from '~/rule';

const testRule = getTestRule({
plugins: [plugin],
});

testRule({
ruleName,
config: [
true,
{
browserslist: 'chrome 114',
},
],
reject: [
{
code: stripIndent`
#id {
align-content: safe center;
}
`,
line: 2,
column: 18,
endLine: 2,
endColumn: 22,
message: messages.rejected('"safe" value specified as align-content', 'Chrome 114', ''),
},
{
code: stripIndent`
#id {
align-content: unsafe center;
}
`,
line: 2,
column: 18,
endLine: 2,
endColumn: 24,
message: messages.rejected('"unsafe" value specified as align-content', 'Chrome 114', ''),
},
],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable sort/object-properties */
import { stripIndent } from 'common-tags';
import { getTestRule } from 'jest-preset-stylelint';

import { messages, plugin, ruleName } from '~/rule';

const testRule = getTestRule({
plugins: [plugin],
});

testRule({
ruleName,
config: [
true,
{
browserslist: 'chrome 59',
},
],
reject: [
{
code: stripIndent`
#id {
align-content: space-evenly;
}
`,
line: 2,
column: 18,
endLine: 2,
endColumn: 30,
message: messages.rejected('"space-evenly" value specified as align-content', 'Chrome 59', ''),
},
],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/* eslint-disable sort/object-properties */
import { stripIndent } from 'common-tags';
import { getTestRule } from 'jest-preset-stylelint';

import { messages, plugin, ruleName } from '~/rule';

const testRule = getTestRule({
plugins: [plugin],
});

testRule({
ruleName,
config: [
true,
{
allow: {
features: ['properties.align-content.flex_context.safe_unsafe'],
},
browserslist: 'chrome 92',
},
],
reject: [
{
code: stripIndent`
#id {
align-content: start;
}
`,
line: 2,
column: 18,
endLine: 2,
endColumn: 23,
message: messages.rejected('"start" value specified as align-content', 'Chrome 92', ''),
},
{
code: stripIndent`
#id {
align-content: safe start;
}
`,
line: 2,
column: 23,
endLine: 2,
endColumn: 28,
message: messages.rejected('"start" value specified as align-content', 'Chrome 92', ''),
},
{
code: stripIndent`
#id {
align-content: unsafe start;
}
`,
line: 2,
column: 25,
endLine: 2,
endColumn: 30,
message: messages.rejected('"start" value specified as align-content', 'Chrome 92', ''),
},
{
code: stripIndent`
#id {
align-content: end;
}
`,
line: 2,
column: 18,
endLine: 2,
endColumn: 21,
message: messages.rejected('"end" value specified as align-content', 'Chrome 92', ''),
},
{
code: stripIndent`
#id {
align-content: safe end;
}
`,
line: 2,
column: 23,
endLine: 2,
endColumn: 26,
message: messages.rejected('"end" value specified as align-content', 'Chrome 92', ''),
},
{
code: stripIndent`
#id {
align-content: unsafe end;
}
`,
line: 2,
column: 25,
endLine: 2,
endColumn: 28,
message: messages.rejected('"end" value specified as align-content', 'Chrome 92', ''),
},
],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable sort/object-properties */
import { stripIndent } from 'common-tags';
import { getTestRule } from 'jest-preset-stylelint';

import { messages, plugin, ruleName } from '~/rule';

const testRule = getTestRule({
plugins: [plugin],
});

testRule({
ruleName,
config: [
true,
{
browserslist: 'chrome 56',
},
],
reject: [
{
code: stripIndent`
#id {
align-content: stretch;
}
`,
line: 2,
column: 18,
endLine: 2,
endColumn: 25,
message: messages.rejected('"stretch" value specified as align-content', 'Chrome 56', ''),
},
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,24 @@ testRule({
config: [
true,
{
browserslist: 'chrome 17',
browserslist: 'chrome 20',
},
],
reject: [
{
code: stripIndent`
@page :right {
#id {
align-content: normal;
}
`,
line: 1,
column: 7,
endLine: 1,
endColumn: 12,
line: 2,
column: 3,
endLine: 2,
endColumn: 16,
message: messages.rejected(
'":right" pseudo-class',
'Chrome 17',
'https://developer.mozilla.org/docs/Web/CSS/:right',
'"align-content" property',
'Chrome 20',
'https://developer.mozilla.org/docs/Web/CSS/align-content',
),
},
],
Expand Down
Loading