This commit is contained in:
brantje 2017-05-13 21:50:15 +02:00
Родитель 1f3aec7c23
Коммит d293f83227
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 5FF1D117F918687F
7 изменённых файлов: 1466 добавлений и 14 удалений

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

@ -71,6 +71,12 @@ module.exports = function (grunt) {
dest: 'dist/'
}
},
karma: {
unit: {
configFile: './karma.conf.js',
background: false
}
},
compress: {
dist: {
options: {
@ -97,6 +103,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-execute');
grunt.loadNpmTasks('grunt-karma');
// Default task(s).
grunt.registerTask('hint', ['jshint']);

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

@ -189,5 +189,3 @@ input {
padding-left: 8px;
padding-top: 5%;
cursor: pointer; }
/*# sourceMappingURL=main.css.map */

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

@ -6,8 +6,9 @@ function processURL(URL, ignoreProtocol, ignoreSubdomain, ignorePath, ignorePort
try {
URLobj = new window.URL(URL);
}
catch (err) {
if (ignoreProtocol) {
if (ignoreProtocol) {
try {
URLobj = new window.URL("http://" + URL);
}
@ -19,12 +20,15 @@ function processURL(URL, ignoreProtocol, ignoreSubdomain, ignorePath, ignorePort
return URL;
}
}
var parser = document.createElement('a');
parser.href = URL;
var protocol = URLobj.scheme;
var host = URLobj.host;
var path = URLobj.path;
var port = URLobj.port;
var protocol = parser.protocol;
var host = parser.hostname;
var path = parser.pathname;
var port = parser.port;
if (host === null || host === "") {
return URL;
}
@ -55,13 +59,13 @@ function processURL(URL, ignoreProtocol, ignoreSubdomain, ignorePath, ignorePort
}
var returnURL = "";
if (!ignoreProtocol) {
returnURL += protocol + "://";
returnURL += protocol + "//";
}
if (!ignoreSubdomain) {
returnURL += host;
}
else {
returnURL += baseHost;
returnURL += host;
}
if (ignorePort) {
returnURL = returnURL.replace(':' + port, "");

69
karma.conf.js Normal file
Просмотреть файл

@ -0,0 +1,69 @@
// Karma configuration
// Generated on Mon Oct 17 2016 15:46:52 GMT+0200 (CEST)
var isTravis = (process.env.TRAVIS_BUILD_NUMBER) ? true : false;
var browsers = ['Firefox'];
if(!isTravis){
browsers = ['Chrome'];
}
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '.',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'js/lib/parseUrl.js',
{ pattern: 'tests/**/*.js', included: true }
],
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['verbose'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: browsers,
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true
});
};

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

@ -6,16 +6,22 @@
"dependencies": {
"grunt": "~0.4.5",
"grunt-cli": "~1.2.0",
"grunt-contrib-jshint": "^0.12.0",
"jshint-stylish": "^2.2.1"
},
"devDependencies": {
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-compress": "^1.4.1",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-jshint": "^0.12.0",
"grunt-execute": "^0.2.2",
"grunt-mkdir": "^1.0.0"
"grunt-karma": "^2.0.0",
"grunt-mkdir": "^1.0.0",
"jasmine-core": "^2.6.1",
"jshint-stylish": "^2.2.1",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.1.1",
"karma-firefox-launcher": "^1.0.1",
"karma-jasmine": "^1.1.0",
"karma-verbose-reporter": "0.0.6"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},

1368
tests/unit/lib/parseUrl.js Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

0
tests/unit/parseUrl.js Normal file
Просмотреть файл