mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
fix merge issue
This commit is contained in:
@ -25,28 +25,25 @@ import scrollViewModule = require("ui/scroll-view");
|
|||||||
|
|
||||||
// </snippet>
|
// </snippet>
|
||||||
|
|
||||||
var ASYNC = 0.3;
|
class ScrollLayoutTest extends testModule.UITest<scrollViewModule.ScrollView> {
|
||||||
var tmp: buttonModule.Button;
|
|
||||||
var newPage: page.Page;
|
|
||||||
|
|
||||||
public create(): scrollViewModule.ScrollView {
|
public create(): scrollViewModule.ScrollView {
|
||||||
return new scrollViewModule.ScrollView();
|
return new scrollViewModule.ScrollView();
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_snippets() {
|
public test_snippets() {
|
||||||
// <snippet module="ui/scroll-view" title="scroll-view">
|
// <snippet module="ui/scroll-view" title="scroll-view">
|
||||||
// ### Creating a ScrollView
|
// ### Creating a ScrollView
|
||||||
// ``` JavaScript
|
// ``` JavaScript
|
||||||
var scrollView = new scrollViewModule.ScrollView();
|
var scrollView = new scrollViewModule.ScrollView();
|
||||||
// ```
|
// ```
|
||||||
// </snippet>
|
// </snippet>
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_default_TNS_values() {
|
public test_default_TNS_values() {
|
||||||
TKUnit.assertEqual(this.testView.orientation, enums.Orientation.vertical, "Default this.testView.orientation");
|
TKUnit.assertEqual(this.testView.orientation, enums.Orientation.vertical, "Default this.testView.orientation");
|
||||||
TKUnit.assertEqual(this.testView.verticalOffset, 0, "Default this.testView.verticalOffset");
|
TKUnit.assertEqual(this.testView.verticalOffset, 0, "Default this.testView.verticalOffset");
|
||||||
TKUnit.assertEqual(this.testView.horizontalOffset, 0, "Default this.testView.horizontalOffset");
|
TKUnit.assertEqual(this.testView.horizontalOffset, 0, "Default this.testView.horizontalOffset");
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_vertical_oriantation_creates_correct_native_view() {
|
public test_vertical_oriantation_creates_correct_native_view() {
|
||||||
this.testView.orientation = enums.Orientation.vertical;
|
this.testView.orientation = enums.Orientation.vertical;
|
||||||
@ -57,7 +54,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
else if (app.ios) {
|
else if (app.ios) {
|
||||||
TKUnit.assert(this.testView.ios instanceof UIScrollView, "ios property is UIScrollView");
|
TKUnit.assert(this.testView.ios instanceof UIScrollView, "ios property is UIScrollView");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_horizontal_oriantation_creates_correct_native_view() {
|
public test_horizontal_oriantation_creates_correct_native_view() {
|
||||||
this.testView.orientation = enums.Orientation.horizontal;
|
this.testView.orientation = enums.Orientation.horizontal;
|
||||||
@ -68,14 +65,14 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
else if (app.ios) {
|
else if (app.ios) {
|
||||||
TKUnit.assert(this.testView.ios instanceof UIScrollView, "ios property is UIScrollView");
|
TKUnit.assert(this.testView.ios instanceof UIScrollView, "ios property is UIScrollView");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_scrollabeHeight_vertical_orientation_when_content_is_small() {
|
public test_scrollabeHeight_vertical_orientation_when_content_is_small() {
|
||||||
this.testView.orientation = enums.Orientation.vertical;
|
this.testView.orientation = enums.Orientation.vertical;
|
||||||
this.testView.width = 200;
|
this.testView.width = 200;
|
||||||
this.testView.height = 300;
|
this.testView.height = 300;
|
||||||
|
|
||||||
var btn = new button.Button();
|
let btn = new button.Button();
|
||||||
btn.text = "test";
|
btn.text = "test";
|
||||||
btn.height = 100;
|
btn.height = 100;
|
||||||
this.testView.content = btn;
|
this.testView.content = btn;
|
||||||
@ -83,7 +80,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
this.waitUntilTestElementLayoutIsValid();
|
this.waitUntilTestElementLayoutIsValid();
|
||||||
TKUnit.assertEqual(this.testView.scrollableHeight, 0, "this.testView.scrollableHeight");
|
TKUnit.assertEqual(this.testView.scrollableHeight, 0, "this.testView.scrollableHeight");
|
||||||
TKUnit.assertEqual(this.testView.scrollableWidth, 0, "this.testView.scrollableWidth");
|
TKUnit.assertEqual(this.testView.scrollableWidth, 0, "this.testView.scrollableWidth");
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_scrollabeHeight_vertical_orientation_when_content_is_big() {
|
public test_scrollabeHeight_vertical_orientation_when_content_is_big() {
|
||||||
this.testView.orientation = enums.Orientation.vertical;
|
this.testView.orientation = enums.Orientation.vertical;
|
||||||
@ -91,7 +88,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
this.testView.width = 200;
|
this.testView.width = 200;
|
||||||
this.testView.height = 300;
|
this.testView.height = 300;
|
||||||
|
|
||||||
var btn = new button.Button();
|
let btn = new button.Button();
|
||||||
btn.text = "test";
|
btn.text = "test";
|
||||||
btn.height = 500;
|
btn.height = 500;
|
||||||
this.testView.content = btn;
|
this.testView.content = btn;
|
||||||
@ -100,14 +97,14 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
TKUnit.assertAreClose(this.testView.scrollableHeight, 200, 0.4, "this.testView.scrollableHeight");
|
TKUnit.assertAreClose(this.testView.scrollableHeight, 200, 0.4, "this.testView.scrollableHeight");
|
||||||
TKUnit.assertEqual(this.testView.scrollableWidth, 0, "this.testView.scrollableWidth");
|
TKUnit.assertEqual(this.testView.scrollableWidth, 0, "this.testView.scrollableWidth");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_scrollabeWidth_horizontal_orientation_when_content_is_small() {
|
public test_scrollabeWidth_horizontal_orientation_when_content_is_small() {
|
||||||
this.testView.orientation = enums.Orientation.vertical;
|
this.testView.orientation = enums.Orientation.vertical;
|
||||||
this.testView.width = 200;
|
this.testView.width = 200;
|
||||||
this.testView.height = 300;
|
this.testView.height = 300;
|
||||||
|
|
||||||
var btn = new button.Button();
|
let btn = new button.Button();
|
||||||
btn.text = "test";
|
btn.text = "test";
|
||||||
btn.width = 100;
|
btn.width = 100;
|
||||||
this.testView.content = btn;
|
this.testView.content = btn;
|
||||||
@ -115,7 +112,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
this.waitUntilTestElementLayoutIsValid();
|
this.waitUntilTestElementLayoutIsValid();
|
||||||
TKUnit.assertEqual(this.testView.scrollableHeight, 0, "this.testView.scrollableHeight");
|
TKUnit.assertEqual(this.testView.scrollableHeight, 0, "this.testView.scrollableHeight");
|
||||||
TKUnit.assertEqual(this.testView.scrollableWidth, 0, "this.testView.scrollableWidth");
|
TKUnit.assertEqual(this.testView.scrollableWidth, 0, "this.testView.scrollableWidth");
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_scrollabeWidth_horizontal_orientation_when_content_is_big() {
|
public test_scrollabeWidth_horizontal_orientation_when_content_is_big() {
|
||||||
this.testView.orientation = enums.Orientation.horizontal;
|
this.testView.orientation = enums.Orientation.horizontal;
|
||||||
@ -123,7 +120,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
this.testView.width = 200;
|
this.testView.width = 200;
|
||||||
this.testView.height = 300;
|
this.testView.height = 300;
|
||||||
|
|
||||||
var btn = new button.Button();
|
let btn = new button.Button();
|
||||||
btn.text = "test";
|
btn.text = "test";
|
||||||
btn.width = 500;
|
btn.width = 500;
|
||||||
this.testView.content = btn;
|
this.testView.content = btn;
|
||||||
@ -131,7 +128,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
this.waitUntilTestElementLayoutIsValid();
|
this.waitUntilTestElementLayoutIsValid();
|
||||||
TKUnit.assertEqual(this.testView.scrollableHeight, 0, "this.testView.scrollableHeight");
|
TKUnit.assertEqual(this.testView.scrollableHeight, 0, "this.testView.scrollableHeight");
|
||||||
TKUnit.assertAreClose(this.testView.scrollableWidth, 300, 0.4, "this.testView.scrollableWidth");
|
TKUnit.assertAreClose(this.testView.scrollableWidth, 300, 0.4, "this.testView.scrollableWidth");
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_scrollToVerticalOffset_no_animation() {
|
public test_scrollToVerticalOffset_no_animation() {
|
||||||
this.testView.orientation = enums.Orientation.vertical;
|
this.testView.orientation = enums.Orientation.vertical;
|
||||||
@ -139,7 +136,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
this.testView.width = 200;
|
this.testView.width = 200;
|
||||||
this.testView.height = 300;
|
this.testView.height = 300;
|
||||||
|
|
||||||
var btn = new button.Button();
|
let btn = new button.Button();
|
||||||
btn.text = "test";
|
btn.text = "test";
|
||||||
btn.height = 500;
|
btn.height = 500;
|
||||||
this.testView.content = btn;
|
this.testView.content = btn;
|
||||||
@ -148,7 +145,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
TKUnit.assertEqual(this.testView.verticalOffset, 0, "this.testView.verticalOffset");
|
TKUnit.assertEqual(this.testView.verticalOffset, 0, "this.testView.verticalOffset");
|
||||||
this.testView.scrollToVerticalOffset(100, false);
|
this.testView.scrollToVerticalOffset(100, false);
|
||||||
TKUnit.assertAreClose(this.testView.verticalOffset, 100, 0.1, "this.testView.verticalOffset");
|
TKUnit.assertAreClose(this.testView.verticalOffset, 100, 0.1, "this.testView.verticalOffset");
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_scrollToVerticalOffset_with_animation() {
|
public test_scrollToVerticalOffset_with_animation() {
|
||||||
this.testView.orientation = enums.Orientation.vertical;
|
this.testView.orientation = enums.Orientation.vertical;
|
||||||
@ -156,7 +153,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
this.testView.width = 200;
|
this.testView.width = 200;
|
||||||
this.testView.height = 300;
|
this.testView.height = 300;
|
||||||
|
|
||||||
var btn = new button.Button();
|
let btn = new button.Button();
|
||||||
btn.text = "test";
|
btn.text = "test";
|
||||||
btn.height = 500;
|
btn.height = 500;
|
||||||
this.testView.content = btn;
|
this.testView.content = btn;
|
||||||
@ -172,7 +169,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
|
|
||||||
// The scrolling animation should be finished by now
|
// The scrolling animation should be finished by now
|
||||||
TKUnit.assertAreClose(this.testView.verticalOffset, 100, 0.1, "this.testView.verticalOffset");
|
TKUnit.assertAreClose(this.testView.verticalOffset, 100, 0.1, "this.testView.verticalOffset");
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_scrollToHorizontalOffset_no_animation() {
|
public test_scrollToHorizontalOffset_no_animation() {
|
||||||
this.testView.orientation = enums.Orientation.horizontal;
|
this.testView.orientation = enums.Orientation.horizontal;
|
||||||
@ -180,7 +177,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
this.testView.width = 200;
|
this.testView.width = 200;
|
||||||
this.testView.height = 300;
|
this.testView.height = 300;
|
||||||
|
|
||||||
var btn = new button.Button();
|
let btn = new button.Button();
|
||||||
btn.text = "test";
|
btn.text = "test";
|
||||||
btn.width = 500;
|
btn.width = 500;
|
||||||
this.testView.content = btn;
|
this.testView.content = btn;
|
||||||
@ -189,7 +186,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
TKUnit.assertEqual(this.testView.horizontalOffset, 0, "this.testView.horizontalOffset");
|
TKUnit.assertEqual(this.testView.horizontalOffset, 0, "this.testView.horizontalOffset");
|
||||||
this.testView.scrollToHorizontalOffset(100, false);
|
this.testView.scrollToHorizontalOffset(100, false);
|
||||||
TKUnit.assertAreClose(this.testView.horizontalOffset, 100, 0.1, "this.testView.horizontalOffset");
|
TKUnit.assertAreClose(this.testView.horizontalOffset, 100, 0.1, "this.testView.horizontalOffset");
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_scrollToHorizontalOffset_with_animation() {
|
public test_scrollToHorizontalOffset_with_animation() {
|
||||||
this.testView.orientation = enums.Orientation.horizontal;
|
this.testView.orientation = enums.Orientation.horizontal;
|
||||||
@ -197,7 +194,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
this.testView.width = 200;
|
this.testView.width = 200;
|
||||||
this.testView.height = 300;
|
this.testView.height = 300;
|
||||||
|
|
||||||
var btn = new button.Button();
|
let btn = new button.Button();
|
||||||
btn.text = "test";
|
btn.text = "test";
|
||||||
btn.width = 500;
|
btn.width = 500;
|
||||||
this.testView.content = btn;
|
this.testView.content = btn;
|
||||||
@ -213,7 +210,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
|
|
||||||
// The scrolling animation should be finished by now
|
// The scrolling animation should be finished by now
|
||||||
TKUnit.assertAreClose(this.testView.horizontalOffset, 100, 0.1, "this.testView.horizontalOffset");
|
TKUnit.assertAreClose(this.testView.horizontalOffset, 100, 0.1, "this.testView.horizontalOffset");
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_scrollView_persistsState_vertical() {
|
public test_scrollView_persistsState_vertical() {
|
||||||
this.testView.orientation = enums.Orientation.vertical;
|
this.testView.orientation = enums.Orientation.vertical;
|
||||||
@ -240,7 +237,7 @@ var scrollView = new scrollViewModule.ScrollView();
|
|||||||
|
|
||||||
// Check verticalOffset after navigation
|
// Check verticalOffset after navigation
|
||||||
TKUnit.assertAreClose(this.testView.verticalOffset, 100, 0.1, "this.testView.verticalOffset after navigation");
|
TKUnit.assertAreClose(this.testView.verticalOffset, 100, 0.1, "this.testView.verticalOffset after navigation");
|
||||||
}
|
}
|
||||||
|
|
||||||
public test_scrollView_persistsState_horizontal() {
|
public test_scrollView_persistsState_horizontal() {
|
||||||
this.testView.orientation = enums.Orientation.horizontal;
|
this.testView.orientation = enums.Orientation.horizontal;
|
||||||
|
Reference in New Issue
Block a user