1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2025-04-10 13:15:42 +02:00
Nextcloud-News/js
Bernhard Posselt c12a2504cd fix rename
2014-05-23 03:53:24 +02:00
..
app fix rename 2014-05-23 03:53:24 +02:00
build fix rename 2014-05-23 03:53:24 +02:00
controller rename settings to settingsresource 2014-05-23 03:51:37 +02:00
directive add bind unsafe directive 2014-05-23 01:34:18 +02:00
gui uppercase shortcuts 2014-05-23 01:38:33 +02:00
service rename settings to settingsresource 2014-05-23 03:51:37 +02:00
tests rename settings to settingsresource 2014-05-23 03:51:37 +02:00
utility add autopaging directive 2014-05-22 15:09:57 +02:00
vendor es6 all the things 2014-05-21 23:43:28 +02:00
.bowerrc add basic files for js rewrite 2014-05-15 04:36:40 +02:00
.jshintrc add most of the settings except import 2014-05-23 00:44:27 +02:00
bower.json es6 all the things 2014-05-21 23:43:28 +02:00
Gruntfile.js implement serverside 2014-05-23 01:25:55 +02:00
karma.conf.js add most of the settings except import 2014-05-23 00:44:27 +02:00
package.json add chrome to js unit tests 2014-05-22 00:23:49 +02:00
protractor.chrome.conf.js add test for firstrun page 2014-05-19 02:22:02 +02:00
protractor.phantomjs.conf.js add test for firstrun page 2014-05-19 02:22:02 +02:00
README.md add autopaging directive 2014-05-22 15:09:57 +02:00

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 to transpile ES6 into ES5. If you want to take a look at the features see the language features reference.

Iterators

The following iterators are defined and availabe:

  • items:

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

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

    // iterate over list in reverse order
    for (let value of reverse(list)) {
    	console.log(`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