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
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
32 changes: 32 additions & 0 deletions js-api-spec/value/mixin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2021 Google Inc. Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import {SassMixin, compileString} from 'sass';

Check failure on line 5 in js-api-spec/value/mixin.test.ts

View workflow job for this annotation

GitHub Actions / JS API | Embedded | Node 18 | ubuntu-latest

Module '"sass"' has no exported member 'SassMixin'.

Check failure on line 5 in js-api-spec/value/mixin.test.ts

View workflow job for this annotation

GitHub Actions / JS API | Embedded | Node 18 | windows-latest

Module '"sass"' has no exported member 'SassMixin'.

Check failure on line 5 in js-api-spec/value/mixin.test.ts

View workflow job for this annotation

GitHub Actions / JS API | Embedded | Node 18 | macos-latest

Module '"sass"' has no exported member 'SassMixin'.

Check failure on line 5 in js-api-spec/value/mixin.test.ts

View workflow job for this annotation

GitHub Actions / JS API | Embedded | Node 14 | ubuntu-latest

Module '"sass"' has no exported member 'SassMixin'.

Check failure on line 5 in js-api-spec/value/mixin.test.ts

View workflow job for this annotation

GitHub Actions / JS API | Embedded | Node 16 | ubuntu-latest

Module '"sass"' has no exported member 'SassMixin'.

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];
});

expect(
compileString(
`
@use 'sass:meta';

@mixin a() {}
a {b: meta.inspect(foo(meta.get-mixin('a')))}
connorskees marked this conversation as resolved.
Show resolved Hide resolved
`,
{
functions: {'foo($arg)': fn},
}
).css
).toBe('a {\n b: get-mixin("a");\n}');

expect(fn).toHaveBeenCalled();
});
Loading