it('defaults max width to 100', () => { widget.setProperties({ value: 50 }); widget.expectRender(expectedVDom({ width: 50, output: '50%', value: 50 })); });
it('accepts a max to calculate width', () => { widget.setProperties({ max: 200, value: 50 }); widget.expectRender(expectedVDom({ width: 25, output: '25%', value: 50, max: 200 })); });
it('can hide output', () => { widget.setProperties({ value: 50, showOutput: false }); widget.expectRender(expectedVDom({ width: 50, value: 50, output: '50%', showOutput: false })); });
it('can accept an id', () => { widget.setProperties({ value: 50, id: 'my-id' }); widget.expectRender(expectedVDom({ width: 50, output: '50%', value: 50, id: 'my-id' })); });
it('accepts an output function', () => { widget.setProperties({ value: 50, output: (value, percent) => `${value}, ${percent}` }); widget.expectRender(expectedVDom({ width: 50, output: '50, 50', value: 50 })); });
it('accepts decimal values', () => { widget.setProperties({ max: 1, value: 0.2 }); widget.expectRender(expectedVDom({ width: 20, output: '20%', value: 0.2, max: 1 })); });
it('accepts a min and max to calculate width', () => { widget.setProperties({ min: 100, max: 200, value: 150 }); widget.expectRender(expectedVDom({ width: 50, output: '50%', value: 150, min: 100, max: 200 })); });
it('accepts aria properties', () => { widget.setProperties({ value: 50, aria: { describedBy: 'foo', valueNow: 'overridden' } }); const expected = expectedVDom({ width: 50, output: '50%', value: 50 }); assignChildProperties(expected, '0', { 'aria-describedby': 'foo' }); widget.expectRender(expected); });
const { registerSuite } = intern.getInterface('object'); import harness, { Harness } from '@dojo/test-extras/harness'; import { v } from '@dojo/widget-core/d'; import Tab from '../../Tab'; import * as css from '../../../theme/tabcontroller/tabController.m.css'; let widget: Harness<Tab>; registerSuite('Tab', { beforeEach() { widget = harness(Tab); }, afterEach() { widget.destroy(); }, tests: { 'default properties'() { widget.setProperties({ key: 'foo' }); widget.expectRender(v('div', { 'aria-labelledby': undefined, classes: css.tab, id: undefined, role: 'tabpanel' }, [])); },
const { registerSuite } = intern.getInterface('object'); const { assert } = intern.getPlugin('chai'); import harness, { Harness } from '@dojo/test-extras/harness'; import { v } from '@dojo/widget-core/d'; import CalendarCell from '../../CalendarCell'; import * as css from '../../styles/calendar.m.css'; let widget: Harness<CalendarCell>; registerSuite('CalendarCell', { beforeEach() { widget = harness(CalendarCell); }, afterEach() { widget.destroy(); }, tests: { 'Calendar cell with default properties'() { widget.setProperties({ date: 1 }); widget.expectRender(v('td', { key: 'root', role: 'gridcell', 'aria-selected': 'false', tabIndex: -1,