Skip to content

Commit 60e6e7e

Browse files
committed
test: Add tests & ensure Babel supports namespaced props
1 parent f99c146 commit 60e6e7e

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = function (api) {
3131
],
3232
plugins: [
3333
'@babel/plugin-proposal-object-rest-spread',
34-
'@babel/plugin-transform-react-jsx',
34+
['@babel/plugin-transform-react-jsx', { throwIfNamespace: false }],
3535
'babel-plugin-transform-async-to-promises',
3636
['babel-plugin-transform-rename-properties', { rename }]
3737
],

test/browser/render.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,17 @@ describe('render()', () => {
631631
expect(links[3].hasAttribute('href')).to.equal(true);
632632
});
633633

634+
it('should support using `prop:` directive to set properties', () => {
635+
render(<input prop:foo="bar" />, scratch);
636+
expect(scratch.firstChild.foo).to.equal('bar');
637+
expect(scratch.firstChild.getAttribute('foo')).to.equal(null);
638+
});
639+
640+
it('should support using `attr:` directive to set attributes', () => {
641+
render(<input attr:value="foo" />, scratch);
642+
expect(scratch.firstChild.getAttribute('value')).to.equal('foo');
643+
});
644+
634645
describe('dangerouslySetInnerHTML', () => {
635646
it('should support dangerouslySetInnerHTML', () => {
636647
let html = '<b>foo &amp; bar</b>';

0 commit comments

Comments
 (0)