Browse Source

Cleanup.

pull/342/head
Sebastian 7 years ago
parent
commit
06f7c69168
  1. 10
      src/Squidex/app-config/karma-test-shim.js
  2. 12
      src/Squidex/app-config/karma.conf.js
  3. 23
      src/Squidex/app-config/karma.coverage.conf.js
  4. 6
      src/Squidex/app-config/webpack.config.js
  5. 3
      src/Squidex/app-config/webpack.run.base.js
  6. 4
      src/Squidex/app-config/webpack.run.dev.js
  7. 8
      src/Squidex/app-config/webpack.run.prod.js
  8. 3
      src/Squidex/app-config/webpack.test.js
  9. 10
      src/Squidex/wwwroot/scripts/editor-sdk.js

10
src/Squidex/app-config/karma-test-shim.js

@ -21,14 +21,16 @@ testing.TestBed.initTestEnvironment(
var testContext = require.context('../app', true, /\.spec\.ts/); var testContext = require.context('../app', true, /\.spec\.ts/);
/* /**
* get all the files, for each file, call the context function * Get all the files, for each file, call the context function
* that will require the file and load it up here. Context will * that will require the file and load it up here. Context will
* loop and require those spec files here * loop and require those spec files here.
*/ */
function requireAll(requireContext) { function requireAll(requireContext) {
return requireContext.keys().map(requireContext); return requireContext.keys().map(requireContext);
} }
// requires and returns all modules that match /**
* Requires and returns all modules that match.
*/
var modules = requireAll(testContext); var modules = requireAll(testContext);

12
src/Squidex/app-config/karma.conf.js

@ -3,14 +3,14 @@
module.exports = function (config) { module.exports = function (config) {
var _config = { var _config = {
/** /**
* Base path that will be used to resolve all patterns (e.g. files, exclude) * Base path that will be used to resolve all patterns (e.g. files, exclude).
*/ */
basePath: '', basePath: '',
frameworks: ['jasmine'], frameworks: ['jasmine'],
/** /**
* Load additional test shim to setup angular2 for testing * Load additional test shim to setup angular2 for testing.
*/ */
files: [ files: [
{ pattern: './app-config/karma-test-shim.js', watched: false } { pattern: './app-config/karma-test-shim.js', watched: false }
@ -33,21 +33,21 @@ module.exports = function (config) {
noInfo: true noInfo: true
}, },
/* /**
* Leave Jasmine Spec Runner output visible in browser * Leave Jasmine Spec Runner output visible in browser.
*/ */
client: { client: {
clearContext: false clearContext: false
}, },
/* /**
* Use a mocha style console reporter and html reporter. * Use a mocha style console reporter and html reporter.
*/ */
reporters: ['kjhtml', 'mocha'], reporters: ['kjhtml', 'mocha'],
/** /**
* Run with chrome to enable debugging * Run with chrome to enable debugging.
* *
* available browser launchers: https://npmjs.org/browse/keyword/karma-launcher * available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
*/ */

23
src/Squidex/app-config/karma.coverage.conf.js

@ -3,14 +3,14 @@
module.exports = function (config) { module.exports = function (config) {
var _config = { var _config = {
/** /**
* Base path that will be used to resolve all patterns (e.g. files, exclude) * Base path that will be used to resolve all patterns (e.g. files, exclude).
*/ */
basePath: '', basePath: '',
frameworks: ['jasmine'], frameworks: ['jasmine'],
/** /**
* Load additional test shim to setup angular2 for testing * Load additional test shim to setup angular2 for testing.
*/ */
files: [ files: [
{ pattern: './app-config/karma-test-shim.js', watched: false } { pattern: './app-config/karma-test-shim.js', watched: false }
@ -33,21 +33,20 @@ module.exports = function (config) {
noInfo: true noInfo: true
}, },
/* /**
* Use a mocha style console reporter, html reporter and the code coverage reporter * Use a mocha style console reporter, html reporter and the code coverage reporter.
*/ */
reporters: ['mocha', 'html', 'coverage-istanbul'], reporters: ['mocha', 'html', 'coverage-istanbul'],
// HtmlReporter configuration
htmlReporter: { htmlReporter: {
useCompactStyle: true, useCompactStyle: true,
/** /**
* Use the same folder like the html report for coverage reports * Use the same folder like the html report for coverage reports.
*/ */
outputFile: '_test-output/tests.html', outputFile: '_test-output/tests.html',
/** /**
* Group the output by test suite (describe), equivalent to mocha reporter * Group the output by test suite (describe), equivalent to mocha reporter.
*/ */
groupSuites: true groupSuites: true
}, },
@ -64,22 +63,24 @@ module.exports = function (config) {
}, },
/** /**
* Disable continuous Integration mode, run only one time * Disable continuous Integration mode, run only one time.
*/ */
singleRun: true, singleRun: true,
customLaunchers: { customLaunchers: {
ChromeCustom: { ChromeCustom: {
base: 'ChromeHeadless', base: 'ChromeHeadless',
// We must disable the Chrome sandbox (Chrome's sandbox needs more permissions than Docker allows by default) /**
* We must disable the Chrome sandbox (Chrome's sandbox needs more permissions than Docker allows by default).
*/
flags: ['--no-sandbox'] flags: ['--no-sandbox']
} }
}, },
/** /**
* Run with chrome because phantom js does not provide all types, e.g. DragEvent * Run with chrome because phantom js does not provide all types.
* *
* available browser launchers: https://npmjs.org/browse/keyword/karma-launcher * Available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
*/ */
browsers: ['ChromeCustom'] browsers: ['ChromeCustom']
}; };

6
src/Squidex/app-config/webpack.config.js

@ -33,7 +33,7 @@ module.exports = {
] ]
}, },
/* /**
* Options affecting the normal modules. * Options affecting the normal modules.
* *
* See: https://webpack.js.org/configuration/module/ * See: https://webpack.js.org/configuration/module/
@ -109,7 +109,7 @@ module.exports = {
}, },
plugins: [ plugins: [
/* /**
* Puts each bundle into a file and appends the hash of the file to the path. * Puts each bundle into a file and appends the hash of the file to the path.
* *
* See: https://github.com/webpack-contrib/mini-css-extract-plugin * See: https://github.com/webpack-contrib/mini-css-extract-plugin
@ -120,7 +120,7 @@ module.exports = {
options: { options: {
htmlLoader: { htmlLoader: {
/** /**
* Define the root for images, so that we can use absolute url's * Define the root for images, so that we can use absolute urls.
* *
* See: https://github.com/webpack/html-loader#Advanced_Options * See: https://github.com/webpack/html-loader#Advanced_Options
*/ */

3
src/Squidex/app-config/webpack.run.base.js

@ -10,8 +10,7 @@ const plugins = {
module.exports = webpackMerge(commonConfig, { module.exports = webpackMerge(commonConfig, {
/** /**
* The entry point for the bundle * The entry point for the bundle. Our Angular app.
* Our Angular.js app
* *
* See: https://webpack.js.org/configuration/entry-context/ * See: https://webpack.js.org/configuration/entry-context/
*/ */

4
src/Squidex/app-config/webpack.run.dev.js

@ -17,7 +17,9 @@ module.exports = webpackMerge(runConfig, {
output: { output: {
filename: '[name].js', filename: '[name].js',
// Set the public path, because we are running the website from another port (5000) /**
* Set the public path, because we are running the website from another port (5000).
*/
publicPath: 'http://localhost:3000/' publicPath: 'http://localhost:3000/'
}, },

8
src/Squidex/app-config/webpack.run.prod.js

@ -34,15 +34,13 @@ module.exports = webpackMerge(runConfig, {
/** /**
* Specifies the name of each output file on disk. * Specifies the name of each output file on disk.
* IMPORTANT: You must not specify an absolute path here!
* *
* See: https://webpack.js.org/configuration/output/#output-filename * See: https://webpack.js.org/configuration/output/#output-filename
*/ */
filename: '[name].js', filename: '[name].js',
/** /**
* The filename of non-entry chunks as relative path * The filename of non-entry chunks as relative path inside the output.path directory.
* inside the output.path directory.
* *
* See: https://webpack.js.org/configuration/output/#output-chunkfilename * See: https://webpack.js.org/configuration/output/#output-chunkfilename
*/ */
@ -63,7 +61,7 @@ module.exports = webpackMerge(runConfig, {
rules: [{ rules: [{
test: /\.scss$/, test: /\.scss$/,
/* /*
* Extract the content from a bundle to a file * Extract the content from a bundle to a file.
* *
* See: https://github.com/webpack-contrib/extract-text-webpack-plugin * See: https://github.com/webpack-contrib/extract-text-webpack-plugin
*/ */
@ -75,7 +73,7 @@ module.exports = webpackMerge(runConfig, {
loader: 'sass-loader' loader: 'sass-loader'
}], }],
/* /*
* Do not include component styles * Do not include component styles.
*/ */
include: helpers.root('app', 'theme'), include: helpers.root('app', 'theme'),
}, { }, {

3
src/Squidex/app-config/webpack.test.js

@ -8,9 +8,8 @@ module.exports = webpackMerge(commonConfig, {
mode: 'development', mode: 'development',
/** /**
* Source map for Karma from the help of karma-sourcemap-loader & karma-webpack * Source map for Karma from the help of karma-sourcemap-loader & karma-webpack.
* *
* Do not change, leave as is or it wont work.
* See: https://webpack.js.org/configuration/devtool/ * See: https://webpack.js.org/configuration/devtool/
*/ */
devtool: 'inline-source-map' devtool: 'inline-source-map'

10
src/Squidex/wwwroot/scripts/editor-sdk.js

@ -44,7 +44,7 @@ function SquidexFormField() {
}, 500); }, 500);
var editor = { var editor = {
/* /**
* Notifies the control container that the editor has been touched. * Notifies the control container that the editor has been touched.
*/ */
touched: function () { touched: function () {
@ -53,7 +53,7 @@ function SquidexFormField() {
} }
}, },
/* /**
* Notifies the control container that the value has been changed. * Notifies the control container that the value has been changed.
*/ */
valueChanged: function (value) { valueChanged: function (value) {
@ -62,7 +62,7 @@ function SquidexFormField() {
} }
}, },
/* /**
* Register the disabled handler. * Register the disabled handler.
*/ */
onDisabled: function (callback) { onDisabled: function (callback) {
@ -73,7 +73,7 @@ function SquidexFormField() {
} }
}, },
/* /**
* Register the disabled handler. * Register the disabled handler.
*/ */
onValueChanged: function (callback) { onValueChanged: function (callback) {
@ -84,7 +84,7 @@ function SquidexFormField() {
} }
}, },
/* /**
* Clean the editor SDK. * Clean the editor SDK.
*/ */
clean: function () { clean: function () {

Loading…
Cancel
Save