Skip to content

Commit

Permalink
test: for posthtml options, issue #124
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Aug 21, 2020
1 parent 8024ec7 commit fe9e332
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/fixtures/options/directives/fixture.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php echo $myVar; ?>
1 change: 1 addition & 0 deletions test/fixtures/options/directives/fixture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import html from './fixture.html' // eslint-disable-line
3 changes: 3 additions & 0 deletions test/options/__snapshots__/directives.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Options directives {Array} 1`] = `"export default \`<?php echo $myVar; ?>\`"`;
30 changes: 30 additions & 0 deletions test/options/directives.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict'

const webpack = require('../helpers/compiler')

describe('Options', () => {
describe('directives', () => {
test('{Array}', () => {
const config = {
loader: {
test: /\.html$/,
options: {
directives: [{
name: '?php',
start: '<',
end: '>',
}]
}
}
}

return webpack('options/directives/fixture.js', config)
.then((stats) => {
const [module] = stats.toJson().modules

expect(module.source).toMatchSnapshot()
})
.catch((err) => err)
})
})
})

0 comments on commit fe9e332

Please sign in to comment.