Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
jgerigmeyer committed Feb 21, 2024
1 parent 255bdef commit 81cb0ab
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/annotations/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ module.exports = (env) => {
}
}
}
/* istanbul ignore else */
if (sass && !sassCompiler) {
try {
sassCompiler = sass.initAsyncCompiler();
Expand Down
57 changes: 57 additions & 0 deletions test/js/testAnnotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,63 @@ describe('example annotation', () => {
.catch(done);
});

it('uses custom `sass.implementation` string [sass-embedded]', function (done) {
const data = [
{
example: [
{
type: 'scss',
code: '/* just a placeholder */',
},
],
},
];
const env = Object.assign({}, this.env, {
herman: {
sass: {
implementation: 'sass-embedded',
},
},
});
const example = annotations.example(env);
example
.resolve(data)
.then(() => {
assert.equal(data[0].example[0].rendered, data[0].example[0].code);
done();
})
.catch(done);
});

it('custom `sass.implementation` instance [sass-embedded]', function (done) {
const data = [
{
example: [
{
type: 'scss',
code: '/* just a placeholder */',
},
],
},
];
const env = Object.assign({}, this.env, {
herman: {
sass: {
// eslint-disable-next-line global-require
implementation: require('sass-embedded'),
},
},
});
const example = annotations.example(env);
example
.resolve(data)
.then(() => {
assert.equal(data[0].example[0].rendered, data[0].example[0].code);
done();
})
.catch(done);
});

it('skips non-html, non-njk, non-scss items', function (done) {
const data = [
{
Expand Down

0 comments on commit 81cb0ab

Please sign in to comment.