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

add tests for first class mixins #1933

Merged
merged 36 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a03b8f7
add tests for first class mixins
connorskees Aug 25, 2023
99ebbf1
add more apply and get-mixin tests
connorskees Sep 3, 2023
fe8b737
add another content scope test
connorskees Sep 8, 2023
634d71a
tidy, add tests
connorskees Sep 8, 2023
3168534
resolve lints
connorskees Sep 8, 2023
cb3b2d4
fix formatting
connorskees Sep 8, 2023
1dcde0f
ignore libsass
connorskees Sep 8, 2023
7058169
formatting
connorskees Sep 8, 2023
6dfcf9f
add apply built test, update error spans
connorskees Sep 14, 2023
68d906b
Merge branch 'main' of https://github.com/sass/sass-spec into feat/fi…
connorskees Sep 14, 2023
ee795d9
change error message for issue_1079
connorskees Sep 16, 2023
f1dc81d
lint spec
connorskees Sep 18, 2023
9384c56
Merge branch 'main' of https://github.com/sass/sass-spec into feat/fi…
connorskees Sep 18, 2023
e6d89d9
Merge branch 'main' of https://github.com/sass/sass-spec into feat/fi…
connorskees Sep 21, 2023
a6874bf
bump ci
connorskees Sep 21, 2023
a203dfc
pr review
connorskees Sep 22, 2023
565122a
more pr review
connorskees Sep 22, 2023
bdf1d4f
fix lint
connorskees Sep 22, 2023
ff5560f
ignore libsass
connorskees Sep 22, 2023
2617471
add apply tests
connorskees Sep 22, 2023
ad746a1
make more things be on a single line
connorskees Sep 22, 2023
ca84c9c
pr review
connorskees Sep 23, 2023
a290209
add rest argument tests
connorskees Sep 23, 2023
84d29a1
use semantic placeholders in fallthrough tests
connorskees Sep 23, 2023
2318026
use semantic placeholders in redeclare using test
connorskees Sep 25, 2023
6f0fc96
add different rest tests, move error tests
connorskees Sep 27, 2023
156da5b
Merge branch 'main' of https://github.com/sass/sass-spec into feat/fi…
connorskees Sep 29, 2023
f918847
add js api mixin test
connorskees Sep 29, 2023
36e7d78
use apply in test
connorskees Sep 29, 2023
896ccf6
bump ci
connorskees Sep 29, 2023
7ecf824
add negative assertions for mixin
connorskees Sep 29, 2023
2b017e3
alphabetize
connorskees Sep 29, 2023
55fe148
remove faulty assertion
connorskees Oct 4, 2023
d940acb
add back instanceof assertion
connorskees Oct 4, 2023
b3131b8
use proper instanceof check
connorskees Oct 4, 2023
7b989f0
stricter assertMixin, use toBeInstanceOf
connorskees Oct 5, 2023
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
2 changes: 2 additions & 0 deletions js-api-spec/value/boolean.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('Sass boolean', () => {
expect(value.tryMap()).toBe(null);
expect(value.assertNumber).toThrow();
expect(value.assertString).toThrow();
expect(value.assertMixin).toThrow();
connorskees marked this conversation as resolved.
Show resolved Hide resolved
});
});

Expand Down Expand Up @@ -62,6 +63,7 @@ describe('Sass boolean', () => {
expect(value.tryMap()).toBe(null);
expect(value.assertNumber).toThrow();
expect(value.assertString).toThrow();
expect(value.assertMixin).toThrow();
});
});
});
1 change: 1 addition & 0 deletions js-api-spec/value/calculation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describe('SassCalculation', () => {
expect(calculation.tryMap()).toBe(null);
expect(() => calculation.assertNumber()).toThrow();
expect(() => calculation.assertString()).toThrow();
expect(() => calculation.assertMixin()).toThrow();
});
});

Expand Down
1 change: 1 addition & 0 deletions js-api-spec/value/color.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe('SassColor', () => {
expect(color.tryMap()).toBe(null);
expect(() => color.assertNumber()).toThrow();
expect(() => color.assertString()).toThrow();
expect(() => color.assertMixin()).toThrow();
});
});

Expand Down
2 changes: 2 additions & 0 deletions js-api-spec/value/list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('SassList', () => {
expect(list.tryMap()).toBe(null);
expect(() => list.assertNumber()).toThrow();
expect(() => list.assertString()).toThrow();
expect(() => list.assertMixin()).toThrow();
});

it('returns its contents as a list', () => {
Expand Down Expand Up @@ -360,6 +361,7 @@ describe('SassList', () => {
expect(() => list.assertFunction()).toThrow();
expect(() => list.assertNumber()).toThrow();
expect(() => list.assertString()).toThrow();
expect(() => list.assertMixin()).toThrow();
});

it('rejects invalid indices', () => {
Expand Down
1 change: 1 addition & 0 deletions js-api-spec/value/map.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('SassMap', () => {
expect(() => map.assertFunction()).toThrow();
expect(() => map.assertNumber()).toThrow();
expect(() => map.assertString()).toThrow();
expect(() => map.assertMixin()).toThrow();
});

it('returns its contents as a map', () => {
Expand Down
15 changes: 12 additions & 3 deletions js-api-spec/value/mixin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@ import {spy} from '../utils';
it('can round-trip a mixin reference from Sass', () => {
const fn = spy(args => {
expect(args).toBeArrayOfSize(1);
expect(args[0]).toBeInstanceOf(SassMixin);
args[0].assertMixin();
return args[0];
const value = args[0];
expect(value).toBeInstanceOf(SassMixin);
value.assertMixin();
expect(value.assertCalculation).toThrow();
expect(value.assertColor).toThrow();
expect(value.assertFunction).toThrow();
expect(value.assertMap).toThrow();
expect(value.tryMap()).toBe(null);
expect(value.assertNumber).toThrow();
expect(value.assertString).toThrow();

return value;
});

expect(
Expand Down
1 change: 1 addition & 0 deletions js-api-spec/value/null.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ describe('Sass null', () => {
expect(value.tryMap()).toBe(null);
expect(value.assertNumber).toThrow();
expect(value.assertString).toThrow();
expect(value.assertMixin).toThrow();
});
});
1 change: 1 addition & 0 deletions js-api-spec/value/number.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe('Sass number', () => {
expect(() => number.assertMap()).toThrow();
expect(number.tryMap()).toBe(null);
expect(() => number.assertString()).toThrow();
expect(() => number.assertMixin()).toThrow();
});
});

Expand Down
1 change: 1 addition & 0 deletions js-api-spec/value/string.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe('Sass string', () => {
expect(value.assertMap).toThrow();
expect(value.tryMap()).toBe(null);
expect(value.assertNumber).toThrow();
expect(value.assertMixin).toThrow();
});
});

Expand Down