-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Favor ESM tests, ensure CJS still works.
- Loading branch information
1 parent
384c86b
commit 7860d98
Showing
4 changed files
with
92 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const chai = require("chai"); | ||
const { codeEquality } = require("code-equality-assertions/chai"); | ||
|
||
chai.use(codeEquality); | ||
|
||
const { expect } = chai; | ||
|
||
const { Preprocessor } = require("content-tag"); | ||
|
||
const p = new Preprocessor(); | ||
|
||
describe("cjs/require", function () { | ||
it("can call process", function () { | ||
let output = p.process("<template>Hi</template>"); | ||
|
||
expect(output).to | ||
.equalCode(`import { template } from "@ember/template-compiler"; | ||
export default template(\`Hi\`, { | ||
eval () { | ||
return eval(arguments[0]); | ||
} | ||
});`); | ||
}); | ||
|
||
it("can call parse", function () { | ||
let output = p.parse("<template>Hello!</template>"); | ||
|
||
expect(output).to.eql([ | ||
{ | ||
type: "expression", | ||
tagName: "template", | ||
contents: "Hello!", | ||
range: { | ||
start: 0, | ||
end: 27, | ||
}, | ||
contentRange: { | ||
start: 10, | ||
end: 16, | ||
}, | ||
startRange: { | ||
end: 10, | ||
start: 0, | ||
}, | ||
endRange: { | ||
start: 16, | ||
end: 27, | ||
}, | ||
}, | ||
]); | ||
}); | ||
}); |