mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
style(tests): format all files
This commit is contained in:
@@ -114,7 +114,7 @@ export const test_ObservableArray_popShouldRemoveTheLastElement = function () {
|
||||
// >> (hide)
|
||||
const viewBase = new Label();
|
||||
viewBase.set("testProperty", 0);
|
||||
viewBase.bind({sourceProperty: "length", targetProperty: "testProperty"}, array);
|
||||
viewBase.bind({ sourceProperty: "length", targetProperty: "testProperty" }, array);
|
||||
// << (hide)
|
||||
const result = array.pop();
|
||||
// << observable-array-join-pop
|
||||
@@ -157,7 +157,7 @@ export const test_ObservableArray_pushShouldAppendNewElement = function () {
|
||||
// >> (hide)
|
||||
const viewBase = new Label();
|
||||
viewBase.set("testProperty", 0);
|
||||
viewBase.bind({sourceProperty: "length", targetProperty: "testProperty"}, array);
|
||||
viewBase.bind({ sourceProperty: "length", targetProperty: "testProperty" }, array);
|
||||
// << (hide)
|
||||
const result = array.push(4);
|
||||
// << observable-array-push
|
||||
@@ -196,7 +196,7 @@ export const test_ObservableArray_pushShouldAppendNewElements = function () {
|
||||
// >> (hide)
|
||||
const viewBase = new Label();
|
||||
viewBase.set("testProperty", 0);
|
||||
viewBase.bind({sourceProperty: "length", targetProperty: "testProperty"}, array);
|
||||
viewBase.bind({ sourceProperty: "length", targetProperty: "testProperty" }, array);
|
||||
// << (hide)
|
||||
const result = array.push(4, 5, 6);
|
||||
// << observable-array-push-multiple
|
||||
@@ -235,7 +235,7 @@ export const test_ObservableArray_pushShouldAppendNewElementsFromSourceArray = f
|
||||
// >> (hide)
|
||||
const viewBase = new Label();
|
||||
viewBase.set("testProperty", 0);
|
||||
viewBase.bind({sourceProperty: "length", targetProperty: "testProperty"}, array);
|
||||
viewBase.bind({ sourceProperty: "length", targetProperty: "testProperty" }, array);
|
||||
// << (hide)
|
||||
const result = array.push([4, 5, 6]);
|
||||
// << observable-array-push-source
|
||||
@@ -282,7 +282,7 @@ export const test_ObservableArray_shiftShouldRemoveTheFirstElement = function ()
|
||||
// >> (hide)
|
||||
const viewBase = new Label();
|
||||
viewBase.set("testProperty", 0);
|
||||
viewBase.bind({sourceProperty: "length", targetProperty: "testProperty"}, array);
|
||||
viewBase.bind({ sourceProperty: "length", targetProperty: "testProperty" }, array);
|
||||
// << (hide)
|
||||
const result = array.shift();
|
||||
// << observable-array-shift
|
||||
@@ -354,7 +354,7 @@ export const test_ObservableArray_spliceShouldRemoveSpecifiedNumberOfElementsSta
|
||||
// >> (hide)
|
||||
const viewBase = new Label();
|
||||
viewBase.set("testProperty", 0);
|
||||
viewBase.bind({sourceProperty: "length", targetProperty: "testProperty"}, array);
|
||||
viewBase.bind({ sourceProperty: "length", targetProperty: "testProperty" }, array);
|
||||
// << (hide)
|
||||
const result = array.splice(1, 2);
|
||||
// << observable-array-splice
|
||||
@@ -430,7 +430,7 @@ export const test_ObservableArray_unshiftShouldInsertNewElementsFromTheStart = f
|
||||
// >> (hide)
|
||||
const viewBase = new Label();
|
||||
viewBase.set("testProperty", 0);
|
||||
viewBase.bind({sourceProperty: "length", targetProperty: "testProperty"}, array);
|
||||
viewBase.bind({ sourceProperty: "length", targetProperty: "testProperty" }, array);
|
||||
// << (hide)
|
||||
const result = array.unshift(4, 5);
|
||||
// << observable-array-unshift
|
||||
@@ -647,7 +647,7 @@ export const test_reduce_with_initial_value = function () {
|
||||
};
|
||||
|
||||
export const test_reduce_with_zero_as_initial_value = function () {
|
||||
const sa = [{prop: 1}, {prop: 2}, {prop: 3}];
|
||||
const sa = [{ prop: 1 }, { prop: 2 }, { prop: 3 }];
|
||||
let array: ObservableArray<any> = new ObservableArray(sa);
|
||||
const result = array.reduce((a, b) => a + b.prop, 0);
|
||||
TKUnit.assertEqual(result, 6, "ObservableArray reduce function broken when Initial Value is zero.");
|
||||
@@ -672,7 +672,7 @@ export const test_reduceRight_with_initial_value = function () {
|
||||
};
|
||||
|
||||
export const test_reduceRight_with_zero_as_initial_value = function () {
|
||||
const sa = [{prop: 1}, {prop: 2}, {prop: 3}];
|
||||
const sa = [{ prop: 1 }, { prop: 2 }, { prop: 3 }];
|
||||
let array: ObservableArray<any> = new ObservableArray(sa);
|
||||
const result = array.reduceRight((a, b) => a + b.prop, 0);
|
||||
TKUnit.assertEqual(result, 6, "ObservableArray reduceRight function broken when Initial Value is zero.");
|
||||
|
||||
@@ -71,25 +71,25 @@ previous_url: /ApiReference/data/observable-array/HOW-TO
|
||||
### Handle "change" event to know more info about the change after calling shift() method.
|
||||
{%snippet observable-array-shift-change%}
|
||||
|
||||
### Use slice() method to return array with all ObservableArray elements.
|
||||
### Use slice() method to return array with all ObservableArray elements.
|
||||
{%snippet observable-array-slice%}
|
||||
|
||||
### Use slice(star, end) method to return section of the array.
|
||||
### Use slice(star, end) method to return section of the array.
|
||||
{%snippet observable-array-slice-args%}
|
||||
|
||||
### Use sort() method to sort the array.
|
||||
### Use sort() method to sort the array.
|
||||
{%snippet observable-array-sort%}
|
||||
|
||||
### Use sort(compareFunction) method to sort the array with your own comparing logic.
|
||||
### Use sort(compareFunction) method to sort the array with your own comparing logic.
|
||||
{%snippet observable-array-sort-comparer%}
|
||||
|
||||
### Use splice(start, deleteCount) method to delete elements in the array.
|
||||
### Use splice(start, deleteCount) method to delete elements in the array.
|
||||
{%snippet observable-array-splice%}
|
||||
|
||||
### Handle "change" event to know more info about the change after calling splice(start, deleteCount) method.
|
||||
{%snippet observable-array-splice-change%}
|
||||
|
||||
### Use splice(start, deleteCount, ...arguments) method to remove and insert elements in the array.
|
||||
### Use splice(start, deleteCount, ...arguments) method to remove and insert elements in the array.
|
||||
{%snippet observable-array-splice-args%}
|
||||
|
||||
### Handle "change" event to know more info about the change after calling splice(start, deleteCount, ...arguments) method.
|
||||
|
||||
@@ -563,7 +563,7 @@ export function test_get_set_on_observables_fromObject_without_property_in_json(
|
||||
|
||||
export function test_get_set_on_observables_fromObject_with_property_in_json() {
|
||||
const array = new ObservableArray<any>();
|
||||
const vm = fromObject({ p: null});
|
||||
const vm = fromObject({ p: null });
|
||||
vm.set("p", array);
|
||||
const value1 = vm.get("p");
|
||||
const value2 = (<any>vm).p;
|
||||
|
||||
@@ -9,8 +9,8 @@ previous_url: /ApiReference/data/virtual-array/HOW-TO
|
||||
{%snippet virtual-array-require%}
|
||||
|
||||
### Handle "itemsLoading" event to load items on demand using load() method.
|
||||
Use "length" property set via VirtualArray constructor to specify total number of items,
|
||||
"loadSize" to specify number of items to be requested in a single request,
|
||||
Use "length" property set via VirtualArray constructor to specify total number of items,
|
||||
"loadSize" to specify number of items to be requested in a single request,
|
||||
"itemsLoading" event to handle items request and "load()" method to copy items into the array.
|
||||
All already loaded items are cached in -memory and when "getItem()" method is called
|
||||
the array will raise "itemsLoading" event for still not loaded items.
|
||||
|
||||
Reference in New Issue
Block a user