Refactor code

This commit is contained in:
Tyler Long
2017-04-17 00:12:30 +08:00
parent 8b44401b1b
commit 3ac23c21d9
8 changed files with 35 additions and 47 deletions

View File

@@ -11,7 +11,3 @@ require('gulp-insert')
var requireDir = require('require-dir') var requireDir = require('require-dir')
requireDir('./gulp/tasks') requireDir('./gulp/tasks')
// var paths = {
// scripts: ['./src/**/*.js', '!**/parser/*.js']
// }

View File

@@ -4,14 +4,14 @@
module.exports = function (config) { module.exports = function (config) {
config.set({ config.set({
// base path that will be used to resolve all patterns (eg. files, exclude) // base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '.', basePath: '.',
// frameworks to use // frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['browserify', 'jasmine'], frameworks: ['browserify', 'jasmine'],
// list of files / patterns to load in the browser // list of files / patterns to load in the browser
files: [ files: [
'./src/*.spec.js', './src/*.spec.js',
'./src/diagrams/flowchart/**/*.spec.js', './src/diagrams/flowchart/**/*.spec.js',
@@ -23,46 +23,46 @@ module.exports = function (config) {
], ],
preprocessors: { preprocessors: {
'src/**/*.spec.js': [ 'browserify' ] 'src/**/*.spec.js': ['browserify']
}, },
// list of files to exclude // list of files to exclude
// exclude: ['src/diagrams/*.js'], // exclude: ['src/diagrams/*.js'],
browserify: { browserify: {
debug: true, debug: true,
// plugin: ['proxyquireify/plugin'] // plugin: ['proxyquireify/plugin']
extensions: ['.js'], extensions: ['.js'],
configure: function (bundle) { configure: function (bundle) {
bundle.on('prebundle', function () { bundle.on('prebundle', function () {
bundle bundle
.plugin('proxyquire-universal') .plugin('proxyquire-universal')
}) })
} }
}, },
// preprocess matching files before serving them to the browser // preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
// test results reporter to use // test results reporter to use
// possible values: 'dots', 'progress' // possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter // available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['dots'], reporters: ['dots'],
// web server port // web server port
port: 9876, port: 9876,
// enable / disable colors in the output (reporters and logs) // enable / disable colors in the output (reporters and logs)
colors: true, colors: true,
// level of logging // level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO, logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes // enable / disable watching file and executing tests whenever any file changes
autoWatch: true, autoWatch: true,
// start these browsers // start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'], browsers: ['PhantomJS'],
plugins: [ plugins: [
'karma-jasmine', 'karma-jasmine',
@@ -70,8 +70,8 @@ module.exports = function (config) {
'karma-browserify', 'karma-browserify',
'karma-babel-preprocessor' 'karma-babel-preprocessor'
], ],
// Continuous Integration mode // Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits // if true, Karma captures browsers, runs the tests and exits
singleRun: false singleRun: false
}) })
} }

View File

@@ -5,10 +5,14 @@ var navApp = window.angular.module('navApp', [])
navApp.controller('NavAppCtrl', function ($scope) { navApp.controller('NavAppCtrl', function ($scope) {
$scope.items = [ $scope.items = [
{'name': 'Ett', {
'url': 'cases/ett.html'}, 'name': 'Ett',
{'name': 'Two', 'url': 'cases/ett.html'
'url': 'cases/two.html'} },
{
'name': 'Two',
'url': 'cases/two.html'
}
] ]
$scope.frameUrl = 'web.html' $scope.frameUrl = 'web.html'

View File

View File

@@ -9,19 +9,17 @@ for (var file in window.__karma__.files) {
console.log('Testing with: ' + file2) console.log('Testing with: ' + file2)
tests.push(file2) tests.push(file2)
//
} }
} }
} }
// tests.push('parser/flow.spec');
require.config({ require.config({
// Karma serves files from '/base' // Karma serves files from '/base'
baseUrl: '/base/src', baseUrl: '/base/src',
// ask Require.js to load these files (all our tests) // ask Require.js to load these files (all our tests)
deps: tests, deps: tests,
// start test run, once Require.js is done // start test run, once Require.js is done
callback: window.__karma__.start callback: window.__karma__.start
}) })

View File

@@ -20,7 +20,7 @@ require([], function () {
console.log(mermaid) console.log(mermaid)
mermaid.init() mermaid.init()
assert.equal(window.d3.selectAll('path')[0].length, 8, assert.equal(window.d3.selectAll('path')[0].length, 8,
'drew 8 paths') 'drew 8 paths')
done() done()
}) })
}) })

View File

@@ -1,9 +0,0 @@
/**
* Created by knut on 15-03-07.
*/
// define('simple', function () {
// var simple = {
// data: 'info'
// }
// return simple
// })

View File

@@ -3,7 +3,6 @@
- Problem is it's for d3 v4 only - Problem is it's for d3 v4 only
- node console output colors like Chrome console - node console output colors like Chrome console
- default theme doesn't work for class diagram - default theme doesn't work for class diagram
- mermaidAPI.js cannot be required directly
- compile less to css - compile less to css
- don't version control generated content, move them to outside project - don't version control generated content, move them to outside project
- editor - editor