Remove Babel and add ES6 polyfills for PhantomJS

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2018-03-12 10:22:30 +01:00
Родитель 797f102640
Коммит 32ed0b7b89
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CC42AC2A7F0E56D8
8 изменённых файлов: 89 добавлений и 102 удалений

Просмотреть файл

@ -1,5 +0,0 @@
{
"presets": [
"env"
]
}

Просмотреть файл

@ -77,3 +77,6 @@ formatDate = function(arg) {
relative_modified_date = function(arg) {
return arg;
};
// es6-object-assign
window.ObjectAssign.polyfill();

Просмотреть файл

@ -49,12 +49,12 @@ define([
it('does not produce large number of line breaks for nested elements', function() {
var html =
'<div>' +
' <idv>' +
' <div>' +
' line1' +
' </div>' +
'</div>' +
'<div>line2</div>';
var expected = 'line1 line2';
var expected = ' line1 line2';
var actual = HtmlHelper.htmlToText(html);
@ -81,7 +81,7 @@ define([
it('converts lists to text', function() {
var html = '<ul><li>one</li><li>two</li><li>three</li></ul>';
var expected = '* one\n * two\n * three';
var expected = ' * one\n * two\n * three';
var actual = HtmlHelper.htmlToText(html);

Просмотреть файл

@ -200,72 +200,72 @@ define([
describe('from local source (upload)', function () {
it('detects when all local attachments are valid', function() {
localAttachmentA = new LocalAttachment({
var localAttachmentA = new LocalAttachment({
fileName: 'test.zip',
uploadStatus: 3 // success
});
localAttachmentB = new LocalAttachment({
var localAttachmentB = new LocalAttachment({
fileName: 'test2.zip',
uploadStatus: 3 // success
});
view.attachments.add(localAttachmentA);
view.attachments.add(localAttachmentA);
view.attachments.add(localAttachmentB);
expect(view.checkAllAttachmentsValid()).toBe(true);
});
it('detects when at least one local attachment is pending', function() {
localAttachmentA = new LocalAttachment({
var localAttachmentA = new LocalAttachment({
fileName: 'test.zip',
uploadStatus: 0 // pending
});
localAttachmentB = new LocalAttachment({
var localAttachmentB = new LocalAttachment({
fileName: 'test2.zip',
uploadStatus: 3 // success
});
view.attachments.add(localAttachmentA);
view.attachments.add(localAttachmentA);
view.attachments.add(localAttachmentB);
expect(view.checkAllAttachmentsValid()).toBe(false);
});
it('detects when at least one local attachment is ongoing', function() {
localAttachmentA = new LocalAttachment({
var localAttachmentA = new LocalAttachment({
fileName: 'test.zip',
uploadStatus: 1 // ongoing
});
localAttachmentB = new LocalAttachment({
var localAttachmentB = new LocalAttachment({
fileName: 'test2.zip',
uploadStatus: 3 // success
});
view.attachments.add(localAttachmentA);
view.attachments.add(localAttachmentA);
view.attachments.add(localAttachmentB);
expect(view.checkAllAttachmentsValid()).toBe(false);
});
it('detects when at least one local attachment is broken', function() {
localAttachmentA = new LocalAttachment({
var localAttachmentA = new LocalAttachment({
fileName: 'test.zip',
uploadStatus: 2 // error
});
localAttachmentB = new LocalAttachment({
var localAttachmentB = new LocalAttachment({
fileName: 'test2.zip',
uploadStatus: 3 // success
});
view.attachments.add(localAttachmentA);
view.attachments.add(localAttachmentA);
view.attachments.add(localAttachmentB);
expect(view.checkAllAttachmentsValid()).toBe(false);
});
});
describe('from Files', function () {
it('always consider attachments from Files as valid', function() {
localAttachmentA = new Attachment({
var localAttachmentA = new Attachment({
fileName: 'test.zip'
});
localAttachmentB = new Attachment({
var localAttachmentB = new Attachment({
fileName: 'test2.zip'
});
view.attachments.add(localAttachmentA);
view.attachments.add(localAttachmentA);
view.attachments.add(localAttachmentB);
expect(view.checkAllAttachmentsValid()).toBe(true);
});
});

Просмотреть файл

@ -23,8 +23,7 @@ module.exports = {
extensions: '.html',
helperDirs: __dirname + '/templatehelpers'
}
},
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" }
}
]
}
};

Просмотреть файл

@ -16,6 +16,10 @@ module.exports = function (config) {
frameworks: ['jasmine-ajax', 'jasmine', 'sinon'],
files: [
{pattern: 'node_modules/es6-object-assign/dist/object-assign.min.js', included: true},
{pattern: 'node_modules/string.prototype.startswith/startswith.js', included: true},
{pattern: 'node_modules/string.prototype.endswith/endswith.js', included: true},
{pattern: 'node_modules/string.prototype.repeat/repeat.js', included: true},
{pattern: 'node_modules/jquery/dist/jquery.js', included: true},
{pattern: 'js/tests/test-main.js', included: true},
// all files ending in "_test"

132
package-lock.json сгенерированный
Просмотреть файл

@ -658,17 +658,6 @@
"babel-template": "6.26.0"
}
},
"babel-loader": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-7.1.4.tgz",
"integrity": "sha512-/hbyEvPzBJuGpk9o80R0ZyTej6heEOr59GoEUtn8qFKbnx4cJm9FWES6J/iv644sYgrtVw9JJQkjaLW/bqb5gw==",
"dev": true,
"requires": {
"find-cache-dir": "1.0.0",
"loader-utils": "1.1.0",
"mkdirp": "0.5.1"
}
},
"babel-messages": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz",
@ -1113,44 +1102,6 @@
"babel-types": "6.26.0"
}
},
"babel-preset-env": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz",
"integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==",
"dev": true,
"requires": {
"babel-plugin-check-es2015-constants": "6.22.0",
"babel-plugin-syntax-trailing-function-commas": "6.22.0",
"babel-plugin-transform-async-to-generator": "6.24.1",
"babel-plugin-transform-es2015-arrow-functions": "6.22.0",
"babel-plugin-transform-es2015-block-scoped-functions": "6.22.0",
"babel-plugin-transform-es2015-block-scoping": "6.26.0",
"babel-plugin-transform-es2015-classes": "6.24.1",
"babel-plugin-transform-es2015-computed-properties": "6.24.1",
"babel-plugin-transform-es2015-destructuring": "6.23.0",
"babel-plugin-transform-es2015-duplicate-keys": "6.24.1",
"babel-plugin-transform-es2015-for-of": "6.23.0",
"babel-plugin-transform-es2015-function-name": "6.24.1",
"babel-plugin-transform-es2015-literals": "6.22.0",
"babel-plugin-transform-es2015-modules-amd": "6.24.1",
"babel-plugin-transform-es2015-modules-commonjs": "6.26.0",
"babel-plugin-transform-es2015-modules-systemjs": "6.24.1",
"babel-plugin-transform-es2015-modules-umd": "6.24.1",
"babel-plugin-transform-es2015-object-super": "6.24.1",
"babel-plugin-transform-es2015-parameters": "6.24.1",
"babel-plugin-transform-es2015-shorthand-properties": "6.24.1",
"babel-plugin-transform-es2015-spread": "6.22.0",
"babel-plugin-transform-es2015-sticky-regex": "6.24.1",
"babel-plugin-transform-es2015-template-literals": "6.22.0",
"babel-plugin-transform-es2015-typeof-symbol": "6.23.0",
"babel-plugin-transform-es2015-unicode-regex": "6.24.1",
"babel-plugin-transform-exponentiation-operator": "6.24.1",
"babel-plugin-transform-regenerator": "6.26.0",
"browserslist": "2.11.3",
"invariant": "2.2.3",
"semver": "5.4.1"
}
},
"babel-preset-es2015": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz",
@ -1853,16 +1804,6 @@
"pako": "1.0.6"
}
},
"browserslist": {
"version": "2.11.3",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.11.3.tgz",
"integrity": "sha512-yWu5cXT7Av6mVwzWc8lMsJMHWn4xyjSuGYi4IozbVTLUOEYPSagUB8kiMDUHA1fS3zjr8nkxkn9jdvug4BBRmA==",
"dev": true,
"requires": {
"caniuse-lite": "1.0.30000813",
"electron-to-chromium": "1.3.37"
}
},
"buffer": {
"version": "4.9.1",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz",
@ -2060,12 +2001,6 @@
}
}
},
"caniuse-lite": {
"version": "1.0.30000813",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000813.tgz",
"integrity": "sha512-A8ITSmH5SFdMFdC704ggjg+x2z5PzQmVlG8tavwnfvbC33Q1UYrj0+G+Xm0SNAnd4He36fwUE/KEWytOEchw+A==",
"dev": true
},
"caseless": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz",
@ -3343,12 +3278,6 @@
"integrity": "sha1-zIcsFoiArjxxiXYv1f/ACJbJUYo=",
"dev": true
},
"electron-to-chromium": {
"version": "1.3.37",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.37.tgz",
"integrity": "sha1-SpJzTgBEyM8LFVO+V+riGkxuX6s=",
"dev": true
},
"elegant-spinner": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz",
@ -3488,6 +3417,12 @@
"is-arrayish": "0.2.1"
}
},
"es6-object-assign": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz",
"integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=",
"dev": true
},
"es6-promise": {
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz",
@ -3869,6 +3804,11 @@
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
"dev": true
},
"fastparse": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.1.tgz",
"integrity": "sha1-0eJkOzipTXWDtHkGDmxK/8lAcfg="
},
"fd-slicer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz",
@ -5660,6 +5600,32 @@
}
}
},
"handlebars-loader": {
"version": "github:Waavi/handlebars-loader#c51b8354b0cd42bbe4a86b58f264f820443dca7f",
"requires": {
"async": "0.2.10",
"fastparse": "1.1.1",
"loader-utils": "1.0.4",
"object-assign": "4.1.1"
},
"dependencies": {
"async": {
"version": "0.2.10",
"resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz",
"integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E="
},
"loader-utils": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.0.4.tgz",
"integrity": "sha1-E/Vhl/FSOjBYkSSLTHJEVAhIQmw=",
"requires": {
"big.js": "3.1.3",
"emojis-list": "2.1.0",
"json5": "0.5.1"
}
}
}
},
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
@ -9676,7 +9642,8 @@
"process-nextick-args": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
"integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M="
"integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=",
"dev": true
},
"progress": {
"version": "1.1.8",
@ -11448,6 +11415,24 @@
}
}
},
"string.prototype.endswith": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/string.prototype.endswith/-/string.prototype.endswith-0.2.0.tgz",
"integrity": "sha1-oZwg3uUamHd+mkfhDwm+OTubunU=",
"dev": true
},
"string.prototype.repeat": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-0.2.0.tgz",
"integrity": "sha1-q6Nt4I3O5qWjN9SbLqHaGyj8Ds8=",
"dev": true
},
"string.prototype.startswith": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/string.prototype.startswith/-/string.prototype.startswith-0.2.0.tgz",
"integrity": "sha1-2miYLjU6TprEpDtFCiBF0cRFrns=",
"dev": true
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
@ -11916,7 +11901,8 @@
"underscore.string": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.2.3.tgz",
"integrity": "sha1-gGmSYzZl1eX8tNsfs6hi62jp5to="
"integrity": "sha1-gGmSYzZl1eX8tNsfs6hi62jp5to=",
"dev": true
},
"union-value": {
"version": "1.0.0",

Просмотреть файл

@ -25,10 +25,8 @@
},
"homepage": "https://github.com/nextcloud/mail",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.6.1",
"coveralls": "^3.0.0",
"es6-object-assign": "^1.1.0",
"grunt": "^1.0.2",
"grunt-cli": "^1.2.0",
"grunt-contrib-jshint": "^1.1.0",
@ -47,9 +45,11 @@
"karma-sinon": "^1.0.5",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.13",
"phantomjs-prebuilt": "^2.1.16",
"raw-loader": "^0.5.1",
"sinon": "^4.4.2",
"string.prototype.endswith": "^0.2.0",
"string.prototype.repeat": "^0.2.0",
"string.prototype.startswith": "^0.2.0",
"webpack": "^4.1.1",
"webpack-cli": "^2.0.10",
"webpack-merge": "^4.1.2"