summaryrefslogtreecommitdiffstats
path: root/js/README.md
blob: b529fbf6a577866126eb30d8991b40d999b3ba68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# JavaScript Development
Before starting, install nodejs 0.10 and grunt-cli:

	sudo npm -g install grunt-cli

then run:

	npm install

The news app uses [Traceur](https://github.com/google/traceur-compiler) to transpile ES6 into ES5. If you want to take a look at the features see [the language features reference](https://github.com/google/traceur-compiler/wiki/LanguageFeatures#language-features).

### Iterators
The following iterators are defined and availabe:

* **items**:

	```js
	// iterate over object key and value
	for (let [key, value] of items(obj)) {
		console.log(`object key: ${key}, object value: ${value}`)
	}
	```
* **enumerate**:

	```js
	// iterate over list and get the index and value
	for (let [index, value] of enumerate(list)) {
		console.log(`at position: ${index}, value is: ${value}`)
	}
	```

## Building
Watch mode:

	grunt dev

Single run mode:

	grunt

## Testing
Watch mode:

	grunt php
	grunt test

Single run mode:

	grunt phpunit
	grunt ci-unit

### Running e2e tests
Install protractor and set up selenium:

	sudo npm install -g protractor
	sudo webdriver-manager update

then the tests can be started with:

	grunt e2e