Index: core/misc/tests/drupal.test.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/misc/tests/drupal.test.js (date 1478036695000) +++ core/misc/tests/drupal.test.js (date 1478036695000) @@ -0,0 +1,14 @@ +const assert = require('assert'); +domready = function () {}; +Drupal = {}; +const _ = require('../drupal.es6'); + +describe('Drupal', function () { + describe('#checkPlain()', function () { + it('should escape html strings safe for printing', function () { + const html = 'Rock & roll'; + const escaped = '<span class="music">Rock & roll</span>'; + assert.strictEqual(Drupal.checkPlain(html), escaped, 'Drupal.checkPlain escape HTML strings'); + }); + }); +}); Index: core/package.json IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/package.json (date 1478010521000) +++ core/package.json (date 1478036695000) @@ -6,18 +6,31 @@ "scripts": { "build:js": "node ./scripts/js/babel-es6-build.js", "watch:js": "node ./scripts/js/babel-es6-watch.js", - "lint:js": "eslint . --ext=.es6.js || exit 0" + "lint:js": "eslint . --ext=.es6.js || exit 0", + "test:core": "nyc mocha -r jsdom-global/register `find ./misc -name '*.test.js'` || exit 0" }, "devDependencies": { "babel-core": "6.17.0", "babel-preset-es2015": "6.16.0", "chokidar": "1.6.0", "eslint": "3.8.1", - "glob": "^7.1.1" + "glob": "^7.1.1", + "jsdom": "9.8.3", + "jsdom-global": "2.1.0", + "mocha": "3.1.2", + "nyc": "^8.3.2" }, "babel": { "presets": [ "es2015" + ], + "plugins": [ + [ + "transform-object-rest-spread", + { + "useBuiltIns": true + } + ] ] } }