Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions apps/automated/src/ui/styling/style-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,27 @@ export function test_setInlineStyle_setsLocalValues() {
});
}

export function test_setInlineStyle_replacesPreviousDeclarations() {
const testButton = new Button();
testButton.text = 'Test';
const stack = new StackLayout();
stack.addChild(testButton);

helper.buildUIAndRunTest(
stack,
function (views: Array<View>) {
(<any>testButton).style = 'color: red; margin-top: 20;';
helper.assertViewColor(testButton, '#FF0000');
TKUnit.assertEqual(testButton.style.marginTop, 20, 'inline margin-top');

(<any>testButton).style = 'color: blue;';
helper.assertViewColor(testButton, '#0000FF');
TKUnit.assertEqual(testButton.style.marginTop, 8, 'margin-top should fall back to the stylesheet');
},
{ pageCss: 'button { margin-top: 8; }' },
);
}

export function test_setStyle_throws() {
const testButton = new Button();

Expand Down
Loading
Loading