Skip to content

Commit

Permalink
test: import without quotes (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Aug 16, 2019
1 parent dc23895 commit 6be93c8
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/__snapshots__/loader.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,14 @@ exports[`loader should work with multiple "@import" at-rules (node-sass) (scss):
exports[`loader should work with multiple "@import" at-rules (node-sass) (scss): warnings 1`] = `Array []`;
exports[`loader should work with multiple "@import" at-rules without quotes (dart-sass) (sass): errors 1`] = `Array []`;
exports[`loader should work with multiple "@import" at-rules without quotes (dart-sass) (sass): warnings 1`] = `Array []`;
exports[`loader should work with multiple "@import" at-rules without quotes (node-sass) (sass): errors 1`] = `Array []`;
exports[`loader should work with multiple "@import" at-rules without quotes (node-sass) (sass): warnings 1`] = `Array []`;
exports[`loader should work with the "bootstrap" package, import as a package (dart-sass) (sass): errors 1`] = `Array []`;
exports[`loader should work with the "bootstrap" package, import as a package (dart-sass) (sass): warnings 1`] = `Array []`;
Expand Down
19 changes: 19 additions & 0 deletions test/loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,25 @@ describe('loader', () => {
expect(stats.compilation.errors).toMatchSnapshot('errors');
});

it(`should work with multiple "@import" at-rules without quotes (${implementationName}) (${syntax})`, async () => {
if (syntax === 'scss') {
return;
}

const testId = getTestId('import-without-quotes', syntax);
const options = {
implementation: getImplementationByName(implementationName),
};
const stats = await compile(testId, { loader: { options } });

expect(getCodeFromBundle(stats).css).toBe(
getCodeFromSass(testId, options).css
);

expect(stats.compilation.warnings).toMatchSnapshot('warnings');
expect(stats.compilation.errors).toMatchSnapshot('errors');
});

it(`should work and use the "sass" field (${implementationName}) (${syntax})`, async () => {
const testId = getTestId('import-sass-field', syntax);
const options = {
Expand Down
21 changes: 21 additions & 0 deletions test/sass/import-without-quotes.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@import example
@import ./example
@import example.sass
@import ./example.sass
@import example-2
@import ./example-2
@import _example-2
@import ./_example-2
@import directory/file
@import ./directory/file
@import directory/_file
@import ./directory/_file
@import directory-6/file
@import ./directory-6/file
@import directory-6/file/index
@import ./directory-6/file/index
@import directory-6/file/index.sass
@import ./directory-6/file/index.sass
@import directory-6/file/_index.sass
@import ./directory-6/file/_index.sass
@import ~sass/underscore

0 comments on commit 6be93c8

Please sign in to comment.