Skip to content

Commit 615e2de

Browse files
committed
test: Adding compat test suite
1 parent 8582f23 commit 615e2de

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"transpile:jsx": "microbundle src/jsx.js -o dist/jsx.js --target web --external preact && microbundle dist/jsx.js -o dist/jsx.js -f cjs --external preact",
3131
"copy-typescript-definition": "copyfiles -f src/*.d.ts dist",
3232
"test": "eslint src test && tsc && npm run test:mocha && npm run bench",
33-
"test:mocha": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/**/*.test.js",
33+
"test:mocha": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/**/[!compat]*.test.js && npm run test:mocha:compat",
34+
"test:mocha:compat": "BABEL_ENV=test mocha -r @babel/register -r test/setup.js test/compat.test.js",
3435
"format": "prettier src/**/*.{d.ts,js} test/**/*.js --write",
3536
"prepublishOnly": "npm run build",
3637
"release": "npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"

test/compat.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { render } from '../src';
2+
import { createElement } from 'preact/compat';
3+
import { expect } from 'chai';
4+
5+
describe('compat', () => {
6+
it('should not duplicate class attribute when className is empty', async () => {
7+
let rendered = render(createElement('div', { className: '' }));
8+
let expected = `<div class></div>`;
9+
10+
expect(rendered).to.equal(expected);
11+
});
12+
});

0 commit comments

Comments
 (0)