| 7 | const testDir = 'ui/label'; |
| 8 | |
| 9 | export class LabelTest extends testModule.UITest<Label> { |
| 10 | public create(): Label { |
| 11 | const label = new Label(); |
| 12 | label.text = 'Label'; |
| 13 | |
| 14 | return label; |
| 15 | } |
| 16 | |
| 17 | public test_recycling() { |
| 18 | helper.nativeView_recycling_test(() => new Label()); |
| 19 | } |
| 20 | |
| 21 | public test_Label_Members() { |
| 22 | const label = new Label(); |
| 23 | TKUnit.assert(Utils.isDefined(label.text), 'Label.text is not defined'); |
| 24 | TKUnit.assert(Utils.isDefined(label.textWrap), 'Label.textWrap is not defined'); |
| 25 | } |
| 26 | |
| 27 | public snippet_Set_Text_TNS() { |
| 28 | // >> label-settext |
| 29 | const label = new Label(); |
| 30 | const expectedValue = 'Expected Value'; |
| 31 | label.text = expectedValue; |
| 32 | // << label-settext |
| 33 | } |
| 34 | |
| 35 | public snippet_Set_TextWrap_TNS() { |
| 36 | // >> label-textwrap |
| 37 | const label = new Label(); |
| 38 | label.textWrap = true; |
| 39 | // << label-textwrap |
| 40 | } |
| 41 | |
| 42 | public test_Set_Text_TNS() { |
| 43 | const label = this.testView; |
| 44 | const expectedValue = 'Expected Value'; |
| 45 | label.text = expectedValue; |
| 46 | TKUnit.assertEqual(label.text, expectedValue, 'Text not equal'); |
| 47 | } |
| 48 | |
| 49 | public test_Set_Text_Native() { |
| 50 | const testLabel = this.testView; |
| 51 | const expectedValue = 'Expected Value'; |
| 52 | |
| 53 | testLabel.text = expectedValue; |
| 54 | let actualNative; |
| 55 | if (testLabel.ios) { |
| 56 | actualNative = testLabel.ios.text; |
| 57 | } else { |
| 58 | this.waitUntilTestElementIsLoaded(); |
| 59 | actualNative = testLabel.android.getText().toString(); |
| 60 | } |
| 61 | |
| 62 | TKUnit.assertEqual(actualNative, expectedValue, 'Native text not equal'); |
| 63 | } |
| 64 | |
| 65 | public test_Set_Text_Native_Null() { |
| 66 | const testLabel = this.testView; |
nothing calls this directly
no test coverage detected