test: check replaced iff translatable comment
All translatable comments should be replaced, but nothing else.
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
d2ecd03013
commit
793fa8fb52
32
curriculum/test/utils/extract-css-comments.test.js
Normal file
32
curriculum/test/utils/extract-css-comments.test.js
Normal file
@ -0,0 +1,32 @@
|
||||
/* global expect */
|
||||
const extractCSSComments = require('./extract-css-comments');
|
||||
|
||||
const someHTMLWithCSS = `<body>
|
||||
Some text
|
||||
<style>
|
||||
.body {
|
||||
color: red;
|
||||
/* comment 1 */
|
||||
}
|
||||
|
||||
.comment {
|
||||
/* comment 1 */
|
||||
background: green;
|
||||
/* comment 2 */
|
||||
}
|
||||
|
||||
</style>
|
||||
</body>
|
||||
`;
|
||||
|
||||
// NOTE: this is a bit finicky. If the css is, say, missing a semi-colon,
|
||||
// nearby comments may be missed.
|
||||
describe('extractCSSComments', () => {
|
||||
it('should return an object with comment keys and count values', () => {
|
||||
const commentCounts = {
|
||||
'comment 1': 2,
|
||||
'comment 2': 1
|
||||
};
|
||||
expect(extractCSSComments(someHTMLWithCSS)).toEqual(commentCounts);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user