Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a2fee0c

Browse files
committedMar 24, 2017
fix(platform attributes): Change platform specific attributes.
No longer using attributes like android:text since Angular 4.0 strips the part before `:`. BREAKING CHANGES: - Platform-specific attributes now use kebab case i.e. android:text becomes android-text.
1 parent 6c274c0 commit a2fee0c

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed
 

‎nativescript-angular/view-util.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import { ValueSource } from "ui/core/dependency-observable";
1616
import { platformNames, Device } from "platform";
1717
import { rendererLog as traceLog, styleError } from "./trace";
1818

19-
const IOS_PREFX: string = ":ios:";
20-
const ANDROID_PREFX: string = ":android:";
19+
const IOS_PREFX: string = "ios-";
20+
const ANDROID_PREFX: string = "android-";
2121
const XML_ATTRIBUTES = Object.freeze(["style", "rows", "columns", "fontAttributes"]);
2222
const whiteSpaceSplitter = /\s+/;
2323

‎tests/app/tests/platform-filter-components.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class AndroidSpecificComponent {
2929
@Component({
3030
template: `
3131
<StackLayout>
32-
<Label android:text="ANDROID" ios:text="IOS"></Label>
32+
<Label android-text="ANDROID" ios-text="IOS"></Label>
3333
</StackLayout>`
3434
})
3535
export class PlatformSpecificAttributeComponent {

‎tests/app/tests/property-sets.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -87,28 +87,28 @@ describe("setting View properties", () => {
8787
it("sets ios property in ios", () => {
8888
let view = new TestView();
8989
let testUtil = new ViewUtil(iosDevice);
90-
testUtil.setProperty(view, ":ios:anyValue", "blah");
90+
testUtil.setProperty(view, "ios-anyValue", "blah");
9191
assert.strictEqual("blah", view.anyValue);
9292
});
9393

9494
it("doesn\'t set android property in ios", () => {
9595
let view = new TestView();
9696
let testUtil = new ViewUtil(iosDevice);
97-
testUtil.setProperty(view, ":android:anyValue", "blah");
97+
testUtil.setProperty(view, "android-anyValue", "blah");
9898
assert.isUndefined(view.anyValue);
9999
});
100100

101101
it("sets android property in android", () => {
102102
let view = new TestView();
103103
let testUtil = new ViewUtil(androidDevice);
104-
testUtil.setProperty(view, ":android:anyValue", "blah");
104+
testUtil.setProperty(view, "android-anyValue", "blah");
105105
assert.strictEqual("blah", view.anyValue);
106106
});
107107

108108
it("doesn\'t set ios property in android", () => {
109109
let view = new TestView();
110110
let testUtil = new ViewUtil(androidDevice);
111-
testUtil.setProperty(view, ":ios:anyValue", "blah");
111+
testUtil.setProperty(view, "ios-anyValue", "blah");
112112
assert.isUndefined(view.anyValue);
113113
});
114114
});

0 commit comments

Comments
 (0)
Please sign in to comment.