diff --git a/packages/driver-dom/package.json b/packages/driver-dom/package.json index 3172ba1b1e..dca467025d 100644 --- a/packages/driver-dom/package.json +++ b/packages/driver-dom/package.json @@ -1,6 +1,6 @@ { "name": "driver-dom", - "version": "2.1.0", + "version": "2.1.1", "description": "DOM driver for Rax", "license": "BSD-3-Clause", "main": "lib/index.js", diff --git a/packages/driver-dom/src/__tests__/attributes.js b/packages/driver-dom/src/__tests__/attributes.js new file mode 100644 index 0000000000..107886e90c --- /dev/null +++ b/packages/driver-dom/src/__tests__/attributes.js @@ -0,0 +1,105 @@ +import { createElement, render } from 'rax'; +import * as DriverDOM from '../'; + +describe('attributes', () => { + let container; + + beforeEach(() => { + container = document.createElement('div'); + (document.body || document.documentElement).appendChild(container); + }); + + describe('string properties', () => { + it('render string prop with simple numbers', () => { + render(( +
+ ), container, { + driver: DriverDOM + }); + + let node = container.children[0]; + expect(node.getAttribute('width')).toBe('30'); + }); + + it('render string prop with true value', () => { + render(( + + ), container, { + driver: DriverDOM + }); + + let node = container.children[0]; + expect(node.getAttribute('href')).toBe('true'); + }); + + it('render string prop with object value', () => { + render(( + + ), container, { + driver: DriverDOM + }); + + let node = container.children[0]; + expect(node.getAttribute('data')).toBe('[object Object]'); + }); + }); + + describe('boolean properties', () => { + it('render boolean prop with true value', () => { + render(( +