mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix some broken code snippets
This commit is contained in:
@@ -39,5 +39,5 @@ export var test_DummyTestForSnippetOnly4 = function () {
|
||||
export var test_DummyTestForSnippetOnly5 = function () {
|
||||
// >> console-trace
|
||||
console.trace();
|
||||
// << console-traceß
|
||||
// << console-trace
|
||||
}
|
||||
@@ -111,7 +111,7 @@ export var test_ObservableArray_joinShouldReturnStringWithAllItemsSeparatedWithD
|
||||
};
|
||||
|
||||
export var test_ObservableArray_popShouldRemoveTheLastElement = function () {
|
||||
// >> observable-array-join-pop'
|
||||
// >> observable-array-join-pop
|
||||
var array = new observableArrayModule.ObservableArray([1, 2, 3]);
|
||||
// >> (hide)
|
||||
var bindable = new bindableModule.Bindable();
|
||||
@@ -119,7 +119,7 @@ export var test_ObservableArray_popShouldRemoveTheLastElement = function () {
|
||||
bindable.bind({ sourceProperty: "length", targetProperty: "testProperty" }, array);
|
||||
// << (hide)
|
||||
var result = array.pop();
|
||||
// << observable-array-join-pop'
|
||||
// << observable-array-join-pop
|
||||
TKUnit.assert(result === 3 && array.length === 2, "ObservableArray pop() should remove last element!");
|
||||
TKUnit.assert(bindable.get("testProperty") === array.length, "Expected: " + array.length + ", Actual: " + bindable.get("testProperty"));
|
||||
};
|
||||
@@ -359,7 +359,7 @@ export var test_ObservableArray_spliceShouldRemoveSpecifiedNumberOfElementsStart
|
||||
bindable.bind({ sourceProperty: "length", targetProperty: "testProperty" }, array);
|
||||
// << (hide)
|
||||
var result = array.splice(1, 2);
|
||||
// <, observable-array-splice
|
||||
// << observable-array-splice
|
||||
TKUnit.assert(result.length === 2 && result[0] === "two" && array.length === 1 && array.getItem(0) === "one",
|
||||
"ObservableArray splice() should remove specified number of elements starting from specified index!");
|
||||
TKUnit.assert(bindable.get("testProperty") === array.length, "Expected: " + array.length + ", Actual: " + bindable.get("testProperty"));
|
||||
|
||||
@@ -24,7 +24,7 @@ export var test_fetch = function (done: (err: Error, res?: string) => void) {
|
||||
};
|
||||
|
||||
export var test_fetch_text = function (done: (err: Error, res?: string) => void) {
|
||||
// >> fetch-string'
|
||||
// >> fetch-string
|
||||
fetch("https://httpbin.org/get").then(response => { return response.text(); }).then(function (r) {
|
||||
// Argument (r) is string!
|
||||
// >> (hide)
|
||||
@@ -37,7 +37,7 @@ export var test_fetch_text = function (done: (err: Error, res?: string) => void)
|
||||
done(e);
|
||||
// << (hide)
|
||||
});
|
||||
// << fetch-string'
|
||||
// << fetch-string
|
||||
};
|
||||
|
||||
export var test_fetch_json = function (done: (err: Error, res?: string) => void) {
|
||||
|
||||
Reference in New Issue
Block a user