style[] = 'text-align:right'; $el->style[] = null; $el->style[] = 'background-color: blue'; $el->class[] = 'one'; $el->class[] = null; $el->class[] = 'two'; Assert::same('
', (string) $el); $el->style = null; $el->style['text-align'] = 'left'; $el->style['background-color'] = 'green'; Assert::same('', (string) $el); }); test('', function () { $el = Html::el('div'); $el->appendAttribute('style', 'text-align:right'); $el->appendAttribute('style', null); $el->appendAttribute('style', 'background-color: blue'); $el->appendAttribute('class', 'one'); $el->appendAttribute('class', null); $el->appendAttribute('class', 'two'); Assert::same('', (string) $el); $el->setAttribute('style', null); $el->appendAttribute('style', 'text-align', 'left'); $el->appendAttribute('style', 'background-color', 'green'); Assert::same('', (string) $el); $el->setAttribute('style', [ 'text-align' => 'right', 'background-color' => 'red', ]); Assert::same('', (string) $el); $el->appendAttribute('style', [ 'text-align' => 'center', 'color' => 'orange', ]); Assert::same('', (string) $el); }); test('append', function () { $el = Html::el('div'); $el->style('color', 'white'); $el->style('background-color', 'blue'); $el->appendAttribute('style', 'text-align', 'left'); $el->class = 'one'; $el->class('', true); $el->class('two', true); $el->id('my', true); Assert::same('', (string) $el); }); test('append II', function () { $el = Html::el('div'); $el->style[] = 'text-align:right'; $el->style('', true); $el->style('background-color: blue', true); $el->appendAttribute('style', 'color: orange', true); Assert::same('', (string) $el); }); test('append III', function () { $el = Html::el('div'); $el->class('top', true); $el->class('active', true); $el->appendAttribute('class', 'pull-right', true); Assert::same('', (string) $el); $el->class('top', null); $el->class('active', false); $el->appendAttribute('class', 'pull-right', false); Assert::same('', (string) $el); });