Skip to content

Commit

Permalink
test: deprecation message (#915)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Jan 28, 2021
1 parent 955b863 commit ca6eca0
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/__snapshots__/loader.test.js.snap
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
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
@@ -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
@@ -0,0 +1,5 @@
$side-nav-link-bg-hover: hsla(0, 0, 0%, 0.025) !default;

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

0 comments on commit ca6eca0

Please sign in to comment.