feat(renderer): add a setElementStyles method

This commit is contained in:
Matias Niemelä
2016-04-29 15:18:53 -07:00
parent 982fad0c45
commit 1ac38bd69a
7 changed files with 37 additions and 1 deletions

View File

@ -134,7 +134,7 @@ export function main() {
});
}));
it('should update any element property/attributes/class/style independent of the compilation on the root element and other elements',
it('should update any element property/attributes/class/style(s) independent of the compilation on the root element and other elements',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(MyComp2, new ViewMetadata(
{template: '<input [title]="y" style="position:absolute">'}))
@ -156,6 +156,15 @@ export function main() {
renderer.setElementStyle(workerEl, 'width', null);
expect(getDOM().getStyle(el, 'width')).toEqual('');
renderer.setElementStyles(workerEl, {'height': '999px', 'opacity': '0.5'})
expect(getDOM().getStyle(el, 'height'))
.toEqual('999px');
expect(getDOM().getStyle(el, 'opacity')).toEqual('0.5');
renderer.setElementStyles(workerEl, {'height': '999px', 'opacity': null});
expect(getDOM().getStyle(el, 'height'))
.toEqual('999px');
expect(getDOM().getStyle(el, 'opacity')).toEqual('');
renderer.setElementAttribute(workerEl, 'someattr', 'someValue');
expect(getDOM().getAttribute(el, 'someattr')).toEqual('someValue');
};