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

test: deprecation message #915

Merged
merged 2 commits into from
Jan 28, 2021
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
20 changes: 20 additions & 0 deletions test/__snapshots__/loader.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1874,6 +1874,26 @@ exports[`loader should work and ignore all css "@import" at-rules (node-sass) (s

exports[`loader should work and ignore all css "@import" at-rules (node-sass) (scss): warnings 1`] = `Array []`;

exports[`loader should work and output deprecation message (dart-sass): css 1`] = `
"a:hover {
color: rgba(0, 0, 0, 0.025);
}"
`;

exports[`loader should work and output deprecation message (dart-sass): css 2`] = `
"a:hover {
color: rgba(0, 0, 0, 0.025);
}"
`;

exports[`loader should work and output deprecation message (dart-sass): errors 1`] = `Array []`;

exports[`loader should work and output deprecation message (dart-sass): errors 2`] = `Array []`;

exports[`loader should work and output deprecation message (dart-sass): warnings 1`] = `Array []`;

exports[`loader should work and output deprecation message (dart-sass): warnings 2`] = `Array []`;

exports[`loader should work and output the "compressed" outputStyle when "mode" is production (dart-sass) (sass): css 1`] = `"@import\\"./file.css\\";body{font:100% Helvetica,sans-serif;color:#333}nav ul{margin:0;padding:0;list-style:none}nav li{display:inline-block}nav a{display:block;padding:6px 12px;text-decoration:none}.box{-webkit-border-radius:10px;-moz-border-radius:10px;-ms-border-radius:10px;border-radius:10px}.message,.warning,.error,.success{border:1px solid #ccc;padding:10px;color:#333}.success{border-color:green}.error{border-color:red}.warning{border-color:#ff0}.foo:before{content:\\"\\"}.bar:before{content:\\"∑\\"}"`;

exports[`loader should work and output the "compressed" outputStyle when "mode" is production (dart-sass) (sass): errors 1`] = `Array []`;
Expand Down
16 changes: 16 additions & 0 deletions test/loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,22 @@ describe("loader", () => {
expect(getWarnings(stats)).toMatchSnapshot("warnings");
expect(getErrors(stats)).toMatchSnapshot("errors");
});

it(`should work and output deprecation message (${implementationName})`, async () => {
const testId = getTestId("deprecation", syntax);
const options = {
implementation: getImplementationByName(implementationName),
};
const compiler = getCompiler(testId, { loader: { options } });
const stats = await compile(compiler);
const codeFromBundle = getCodeFromBundle(stats, compiler);
const codeFromSass = getCodeFromSass(testId, options);

expect(codeFromBundle.css).toBe(codeFromSass.css);
expect(codeFromBundle.css).toMatchSnapshot("css");
expect(getWarnings(stats)).toMatchSnapshot("warnings");
expect(getErrors(stats)).toMatchSnapshot("errors");
});
}
});
});
Expand Down
4 changes: 4 additions & 0 deletions test/sass/deprecation.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$side-nav-link-bg-hover: hsla(0, 0, 0%, 0.025) !default

a:hover
color: $side-nav-link-bg-hover
5 changes: 5 additions & 0 deletions test/scss/deprecation.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$side-nav-link-bg-hover: hsla(0, 0, 0%, 0.025) !default;

a:hover {
color: $side-nav-link-bg-hover
}