mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Add the new snippet injector in grunt task
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
To run tests please build using one of the *_Tests build configurations and call runAll() method of the Tests module. For example:
|
||||
|
||||
##iOS
|
||||
``` JavaScript
|
||||
var app = require("application");
|
||||
app.init(null);
|
||||
var tests = require("Tests");
|
||||
tests.runAll();
|
||||
```
|
||||
|
||||
##Android
|
||||
``` JavaScript
|
||||
app.init({
|
||||
getActivity: function(intent) {
|
||||
return com.tns.NativeScriptActivity.extend({});
|
||||
},
|
||||
onCreate: function() {
|
||||
require("application").init(this);
|
||||
require("Tests").runAll();
|
||||
}
|
||||
});
|
||||
```
|
||||
@@ -1,70 +1,43 @@
|
||||
export var test_DummyTestForSnippetOnly0 = function () {
|
||||
// <snippet module="console" title="console">
|
||||
// # Console
|
||||
// ### Logging
|
||||
// Logging to the console does not require the "console" module since the console variable is global. It can be used anywhere within your code.
|
||||
// You can log your message in several different categories.
|
||||
// ``` JavaScript
|
||||
//// Verbously logs a message.
|
||||
// >> console-log
|
||||
console.log("Hello, world!");
|
||||
console.info("I am NativeScript");
|
||||
console.warn("Low memory");
|
||||
console.error("Uncaught Application Exception");
|
||||
// ```
|
||||
// </snippet>
|
||||
// << console-log
|
||||
}
|
||||
|
||||
export var test_DummyTestForSnippetOnly1 = function () {
|
||||
// <snippet module="console" title="console">
|
||||
// ### Time
|
||||
// ``` JavaScript
|
||||
//// Begins counting a time span for a given name (key).
|
||||
// >> console-time
|
||||
console.time("LoadTime");
|
||||
//// Do something...
|
||||
//// Ends a previously started time span through the time method.
|
||||
// << console-time
|
||||
// >> console-timeEnd
|
||||
console.timeEnd("LoadTime");
|
||||
// ```
|
||||
// </snippet>
|
||||
// << console-timeEnd
|
||||
}
|
||||
|
||||
export var test_DummyTestForSnippetOnly2 = function () {
|
||||
// <snippet module="console" title="console">
|
||||
// ### Assert
|
||||
// ``` JavaScript
|
||||
//// Asserts a boolean condition and prints a message in case the assert fails.
|
||||
// >> console-assert
|
||||
console.assert(2 === 2, "2 equals 2");
|
||||
// ```
|
||||
// </snippet>
|
||||
// << console-assert
|
||||
}
|
||||
|
||||
export var test_DummyTestForSnippetOnly3 = function () {
|
||||
// <snippet module="console" title="console">
|
||||
// ### Dir
|
||||
// ``` JavaScript
|
||||
//// Prints the state of the specified object to the console.
|
||||
// >> console-dir
|
||||
var obj = {name: "John", age: 34};
|
||||
console.dir(obj);
|
||||
// ```
|
||||
// </snippet>
|
||||
// << console-dir
|
||||
}
|
||||
|
||||
export var test_DummyTestForSnippetOnly4 = function () {
|
||||
// <snippet module="console" title="console">
|
||||
// ### Dump
|
||||
// ``` JavaScript
|
||||
//// Prints the state of the specified object to the console.
|
||||
// >> console-dump
|
||||
var obj = { name: "John", age: 34 };
|
||||
console.dump(obj);
|
||||
// ```
|
||||
// </snippet>
|
||||
// << console-dump
|
||||
}
|
||||
|
||||
export var test_DummyTestForSnippetOnly5 = function () {
|
||||
// <snippet module="console" title="console">
|
||||
// ### Trace
|
||||
// ``` JavaScript
|
||||
//// Prints the current stack trace in the console.
|
||||
// >> console-trace
|
||||
console.trace();
|
||||
// ```
|
||||
// </snippet>
|
||||
// << console-traceß
|
||||
}
|
||||
33
apps/tests/console.md
Normal file
33
apps/tests/console.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
nav-title: "console How-To"
|
||||
title: "How-To"
|
||||
description: "Examples for using console"
|
||||
---
|
||||
# Console
|
||||
### Logging
|
||||
Logging to the console does not require the "console" module since the console variable is global. It can be used anywhere within your code.
|
||||
You can log your message in several different categories.
|
||||
<snippet id='console-log'/>
|
||||
|
||||
### Time
|
||||
Begins counting a time span for a given name (key).
|
||||
<snippet id='console-time'/>
|
||||
|
||||
Ends a previously started time span through the time method.
|
||||
<snippet id='console-timeEnd'/>
|
||||
|
||||
### Assert
|
||||
Asserts a boolean condition and prints a message in case the assert fails.
|
||||
<snippet id='console-assert'/>
|
||||
|
||||
### Dir
|
||||
Prints the state of the specified object to the console.
|
||||
<snippet id='console-dir'/>
|
||||
|
||||
### Dump
|
||||
Prints the state of the specified object to the console.
|
||||
<snippet id='console-dump'/>
|
||||
|
||||
### Trace
|
||||
Prints the current stack trace in the console.
|
||||
<snippet id='console-trace'/>
|
||||
Reference in New Issue
Block a user