diff --git a/.travis.yml b/.travis.yml
index 8a447cee..c91d259e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,5 +7,8 @@ env:
global:
- secure: LhH+mMqOktTe6cIt97PGKBfgUjZM8vRd0qddyg61FSxg7a3WrHQoHE8WdRioJ9+DDzpu/NSTsHEUFUpGN+kSRw1UY4tsNLH6HoBQnqrNN4tVOeefudJpdeteOKZrJ8r8TaA/eO7sAgXO2T+RLJ8+qTbhx8FVZtLaCAgkrS0w9Qk=
- secure: Okwm1aAR3oo09AhHDsjFSq1UGlIUtWYYvYeoolJScC/UVFGMiK9oC4fzRtUHv3kXcnshDlcVDrr/Q5JL9Qx6E+tosPJp+tioaqE8X4IDbVk7PPs/ToOOEmWnGvxkgmfCGSDuneG8RVhILkhls3fbm0z+rRWlvJkjefeA96T6zps=
+install:
+ - npm install
+ - npm install jquery@1
script: ./run-tests.sh
after_script: npm run coverage
diff --git a/README.md b/README.md
index ef671da9..a563f1e2 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,7 @@ __Jump to__
- [Node.js/Browserify](#node-js-browserify)
- [AMD Modules](#amd-modules)
- [Browser](#browser)
+- [Internet Explorer](#internet-explorer)
- [Downloads](#downloads)
- [API Documentation](#api-documentation)
- [Caveats](#caveats)
@@ -33,7 +34,7 @@ __Jump to__
* **Extensibility**
Linkify is designed to be fast and lightweight, but comes with a powerful plugin API that lets you detect even more information like #hashtags and @mentions.
* **Small footprint**
Linkify and its jQuery interface clock in at approximately 15KB minified (5KB gzipped) - approximately 50% the size of Twitter Text
* **Modern implementation**
Linkify is written in ECMAScript6 and compiles to ES5 for modern JavaScript runtimes.
- * Linkify is compatible with all modern browsers, as well as Internet Explorer 9 and up. Full IE8 support coming soon.
+ * Linkify is compatible with all modern browsers, as well as Internet Explorer 8 and up.
## Demo
[Launch demo](http://soapbox.github.io/linkifyjs/)
@@ -64,6 +65,8 @@ Add [linkify](https://github.com/nfrasser/linkify-shim/raw/master/linkify.min.js
```
+**Note:** A [polyfill](#internet-explorer) is required for Internet Explorer 8.
+
#### Find all links and convert them to anchor tags
```js
@@ -167,6 +170,22 @@ var htmlStr = linkifyStr('Check out soapboxhq.com it is great!');
$('p').linkify();
```
+## Internet Explorer
+
+Linkify natively supports Internet Explorer 9 and above. Internet Explorer 8 is supported with a polyfill.
+
+You can use either [es5-shim](https://github.com/es-shims/es5-shim) (sham also required) or the provided `linkify-polyfill.js`:
+
+```html
+
+
+
+
+
+```
+
## Downloads
Download the [**latest release**](https://github.com/SoapBox/linkifyjs/releases) or clone the [**build repository**](https://github.com/nfrasser/linkify-shim).
diff --git a/gulpfile.js b/gulpfile.js
index a967015b..dcb20abe 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -16,21 +16,17 @@ const concat = require('gulp-concat');
const istanbul = require('gulp-istanbul');
const jshint = require('gulp-jshint');
const mocha = require('gulp-mocha');
-const qunit = require('gulp-qunit');
const rename = require('gulp-rename');
const replace = require('gulp-replace');
const uglify = require('gulp-uglify');
const wrap = require('gulp-wrap');
const rollup = require('./tasks/rollup');
+const quickEs3 = require('./tasks/quick-es3');
var paths = {
src: 'src/**/*.js',
- srcCore: [
- 'src/linkify/core/*.js',
- 'src/linkify/utils/*.js',
- 'src/linkify.js'
- ],
+ srcCore: 'src/linkify.js',
lib: ['lib/**/*.js'],
libTest: ['lib/*.js', 'lib/linkify/**/*.js'],
libCore: [
@@ -41,7 +37,8 @@ var paths = {
amd: 'build/amd/**/*.js',
test: 'test/index.js',
spec: 'test/spec/**.js',
- qunit: 'test/qunit/*html'
+ qunit: 'test/qunit/**.js',
+ polyfill: 'polyfill.js'
};
var tldsReplaceStr = `'${tlds.join('|')}'.split('|')`;
@@ -74,6 +71,7 @@ gulp.task('babel-amd', () =>
.pipe(gulp.dest('build/amd')) // Required for building plugins separately
.pipe(amdOptimize('linkify'))
.pipe(concat('linkify.amd.js'))
+ .pipe(quickEs3())
.pipe(gulp.dest('build'))
);
@@ -81,7 +79,7 @@ gulp.task('babel-amd', () =>
Build core linkify.js
*/
gulp.task('build-core', () =>
- gulp.src('src/linkify.js', {read: false})
+ gulp.src(paths.srcCore, {read: false})
.pipe(rollup({
bundle: {
format: 'iife',
@@ -159,6 +157,7 @@ gulp.task('build-interfaces', () => {
stream = gulp.src(files.amd)
.pipe(concat(`linkify-${intrface}.amd.js`))
.pipe(wrap({src: `templates/linkify-${intrface}.amd.js`}))
+ .pipe(quickEs3())
.pipe(gulp.dest('build'));
streams.push(stream);
@@ -202,6 +201,7 @@ gulp.task('build-plugins', () => {
stream = gulp.src(`build/amd/linkify/plugins/${plugin}.js`)
.pipe(wrap({src: `templates/linkify/plugins/${plugin}.amd.js`}))
.pipe(concat(`linkify-plugin-${plugin}.amd.js`))
+ .pipe(quickEs3())
.pipe(gulp.dest('build'));
streams.push(stream);
@@ -210,20 +210,27 @@ gulp.task('build-plugins', () => {
return merge.apply(this, streams);
});
+gulp.task('build-polyfill', () =>
+ gulp.src(paths.polyfill)
+ .pipe(concat('linkify-polyfill.js'))
+ .pipe(gulp.dest('build'))
+);
+
// Build steps
gulp.task('build', [
'babel',
'babel-amd',
'build-core',
'build-interfaces',
- 'build-plugins'
+ 'build-plugins',
+ 'build-polyfill'
], (cb) => { cb(); });
/**
Lint using jshint
*/
gulp.task('jshint', () =>
- gulp.src([paths.src, paths.test, paths.spec])
+ gulp.src([paths.src, paths.test, paths.spec, paths.qunit])
.pipe(jshint())
.pipe(jshint.reporter(stylish))
.pipe(jshint.reporter('fail'))
@@ -232,7 +239,7 @@ gulp.task('jshint', () =>
/**
Run mocha tests
*/
-gulp.task('mocha', ['build'], () =>
+gulp.task('mocha', ['jshint', 'build'], () =>
gulp.src(paths.test, {read: false})
.pipe(mocha())
);
@@ -240,7 +247,7 @@ gulp.task('mocha', ['build'], () =>
/**
Code coverage reort for mocha tests
*/
-gulp.task('coverage', ['build'], (callback) => {
+gulp.task('coverage', ['jshint', 'build'], (callback) => {
// IMPORTANT: return not required here (and will actually cause bugs!)
gulp.src(paths.libTest)
.pipe(istanbul()) // Covering files
@@ -253,7 +260,7 @@ gulp.task('coverage', ['build'], (callback) => {
});
});
-gulp.task('karma', ['build'], (callback) => {
+gulp.task('karma', (callback) => {
let server = new Server({
configFile: __dirname + '/test/dev.conf.js',
singleRun: true
@@ -261,14 +268,21 @@ gulp.task('karma', ['build'], (callback) => {
return server.start();
});
-gulp.task('karma-chrome', ['build'], (callback) => {
+gulp.task('karma-chrome', (callback) => {
let server = new Server({
configFile: __dirname + '/test/chrome.conf.js',
}, callback);
return server.start();
});
-gulp.task('karma-ci', ['build'], (callback) => {
+gulp.task('karma-firefox', (callback) => {
+ let server = new Server({
+ configFile: __dirname + '/test/firefox.conf.js',
+ }, callback);
+ return server.start();
+});
+
+gulp.task('karma-ci', (callback) => {
let server = new Server({
configFile: __dirname + '/test/ci.conf.js',
singleRun: true
@@ -276,10 +290,35 @@ gulp.task('karma-ci', ['build'], (callback) => {
return server.start();
});
-gulp.task('qunit', ['build'], () =>
- gulp.src(paths.qunit)
- .pipe(qunit())
-);
+gulp.task('karma-amd', (callback) => {
+ let server = new Server({
+ configFile: __dirname + '/test/dev.amd.conf.js',
+ singleRun: true
+ }, callback);
+ return server.start();
+});
+
+gulp.task('karma-amd-chrome', (callback) => {
+ let server = new Server({
+ configFile: __dirname + '/test/chrome.amd.conf.js',
+ }, callback);
+ return server.start();
+});
+
+gulp.task('karma-amd-firefox', (callback) => {
+ let server = new Server({
+ configFile: __dirname + '/test/firefox.amd.conf.js',
+ }, callback);
+ return server.start();
+});
+
+gulp.task('karma-amd-ci', (callback) => {
+ let server = new Server({
+ configFile: __dirname + '/test/ci.amd.conf.js',
+ singleRun: true
+ }, callback);
+ return server.start();
+});
// Build the deprecated legacy interface
gulp.task('build-legacy', ['build'], () =>
@@ -322,14 +361,15 @@ gulp.task('uglify', ['build-legacy'], () => {
gulp.task('dist', ['uglify']);
gulp.task('test', (callback) =>
- runSequence('jshint', 'qunit', 'coverage', callback)
+ runSequence('coverage', 'karma', 'karma-amd', callback)
+);
+gulp.task('test-ci', (callback) =>
+ runSequence('karma-ci', 'karma-amd-ci', callback)
);
-gulp.task('test-ci', ['karma-ci']);
-// Using with other tasks causes an error here for some reason
/**
Build JS and begin watching for changes
*/
-gulp.task('default', ['babel'], () =>
- gulp.watch(paths.src, ['babel'])
+gulp.task('default', ['jshint', 'babel'], () =>
+ gulp.watch(paths.src, ['jshint', 'babel'])
);
diff --git a/package.json b/package.json
index e5b65c08..216bdfe7 100644
--- a/package.json
+++ b/package.json
@@ -33,8 +33,6 @@
"babel-plugin-transform-es2015-modules-amd": "^6.6.5",
"babel-preset-es2015": "^6.6.0",
"babel-preset-es2015-loose": "^7.0.0",
- "brfs": "^1.4.1",
- "browserify": "^13.0.0",
"coveralls": "^2.11.4",
"expect.js": "^0.3.1",
"glob": "^7.0.3",
@@ -44,7 +42,6 @@
"gulp-istanbul": "^0.10.2",
"gulp-jshint": "^2.0.0",
"gulp-mocha": "^2.1.3",
- "gulp-qunit": "^1.3.0",
"gulp-rename": "^1.2.0",
"gulp-replace": "^0.5.4",
"gulp-uglify": "^1.4.2",
@@ -54,17 +51,17 @@
"jshint": "^2.9.1",
"jshint-stylish": "^2.0.1",
"karma": "^0.13.15",
- "karma-browserify": "^5.0.3",
"karma-chrome-launcher": "^0.2.1",
"karma-firefox-launcher": "^0.1.6",
- "karma-mocha": "^0.2.0",
"karma-phantomjs-launcher": "^1.0.0",
+ "karma-qunit": "^1.0.0",
"karma-sauce-launcher": "^0.3.0",
+ "lazypipe": "^1.0.1",
"lodash": "^4.11.1",
"merge-stream": "^1.0.0",
"mocha": "^2.3.3",
"phantomjs-prebuilt": "^2.1.7",
- "qunitjs": "^2.0.0-rc1",
+ "qunitjs": ">=1.23.1",
"requirejs": "^2.1.22",
"rollup": "^0.26.0",
"run-sequence": "^1.1.5",
diff --git a/polyfill.js b/polyfill.js
new file mode 100644
index 00000000..613daa8c
--- /dev/null
+++ b/polyfill.js
@@ -0,0 +1,60 @@
+(function () {
+if (typeof Object.freeze != 'function') {
+ Object.freeze = function (obj) { return obj; }
+}
+if (typeof Object.create != 'function') {
+ Object.create = (function() {
+ var Temp = function() {};
+ return function (prototype) {
+ if(prototype !== Object(prototype) && prototype !== null) {
+ throw TypeError('Argument must be an object or null');
+ }
+ if (prototype === null) {
+ throw Error('null [[Prototype]] not supported');
+ }
+ Temp.prototype = prototype;
+ var result = new Temp();
+ Temp.prototype = null;
+ return result;
+ };
+ })();
+}
+
+if (typeof Object.defineProperty != 'function') {
+ Object.defineProperty = function defineProperty(object, property, descriptor) {
+ if ('value' in descriptor) {
+ object[property] = descriptor.value;
+ }
+ return object;
+ };
+}
+
+if (!Array.prototype.indexOf) {
+ Array.prototype.indexOf = function (searchElement, fromIndex) {
+ var k;
+ if (this == null) {
+ throw new TypeError('"this" is null or not defined');
+ }
+ var o = Object(this);
+ var len = o.length >>> 0;
+ if (len === 0) {
+ return -1;
+ }
+ var n = +fromIndex || 0;
+ if (Math.abs(n) === Infinity) {
+ n = 0;
+ }
+ if (n >= len) {
+ return -1;
+ }
+ k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
+ while (k < len) {
+ if (k in o && o[k] === searchElement) {
+ return k;
+ }
+ k++;
+ }
+ return -1;
+ };
+}
+})();
diff --git a/src/linkify-element.js b/src/linkify-element.js
index 520ab19a..0b9fb28a 100644
--- a/src/linkify-element.js
+++ b/src/linkify-element.js
@@ -97,7 +97,7 @@ function linkifyElementHelper(element, opts, doc) {
let ignoreTags = opts.ignoreTags;
// Is this element already a link?
- if (element.tagName === 'A' || ignoreTags.indexOf(element.tagName) >= 0) {
+ if (element.tagName === 'A' || options.contains(ignoreTags, element.tagName)) {
// No need to linkify
return element;
}
diff --git a/src/linkify-html.js b/src/linkify-html.js
index 1c1e9d33..202854da 100644
--- a/src/linkify-html.js
+++ b/src/linkify-html.js
@@ -1,6 +1,7 @@
import HTML5Tokenizer from './simple-html-tokenizer';
import * as linkify from './linkify';
+const options = linkify.options;
const StartTag = 'StartTag';
const EndTag = 'EndTag';
const Chars = 'Chars';
@@ -27,7 +28,8 @@ export default function linkifyHtml(str, opts={}) {
// Ignore all the contents of ignored tags
let tagName = token.tagName.toUpperCase();
- let isIgnored = tagName === 'A' || opts.ignoreTags.indexOf(tagName) >= 0;
+ let isIgnored = tagName === 'A' ||
+ options.contains(opts.ignoreTags, tagName);
if (!isIgnored) continue;
let preskipLen = linkifiedTokens.length;
diff --git a/src/linkify-jquery.js b/src/linkify-jquery.js
index 154ea4c7..87041d47 100644
--- a/src/linkify-jquery.js
+++ b/src/linkify-jquery.js
@@ -1,14 +1,6 @@
import $ from 'jquery';
import linkifyElement from './linkify-element';
-let doc;
-
-try {
- doc = document;
-} catch (e) {
- doc = null;
-}
-
// Applies the plugin to jQuery
export default function ($, doc=null) {
@@ -22,7 +14,7 @@ export default function ($, doc=null) {
throw new Error(
'Cannot find document implementation. ' +
'If you are in a non-browser environment like Node.js, ' +
- 'pass the document implementation as the third argument to linkifyElement.'
+ 'pass the document implementation as the second argument to linkify/jquery'
);
}
diff --git a/src/linkify/utils/options.js b/src/linkify/utils/options.js
index b999f189..9b22b5dd 100644
--- a/src/linkify/utils/options.js
+++ b/src/linkify/utils/options.js
@@ -1,16 +1,7 @@
-function noop(val) {
- return val;
-}
-
-function yes(val) {
- return true;
-}
-
-function typeToTarget(href, type) {
- return type === 'url' ? '_blank' : null;
-}
-
-function normalize(opts) {
+/**
+ * Convert set of options into objects including all the defaults
+ */
+export function normalize(opts) {
opts = opts || {};
let newLine = opts.newLine || false; // deprecated
let ignoreTags = opts.ignoreTags || [];
@@ -36,8 +27,32 @@ function normalize(opts) {
};
}
-function resolve(value, ...params) {
+/**
+ * Resolve an option's value based on the value of the option and the given
+ * params
+ */
+export function resolve(value, ...params) {
return typeof value === 'function' ? value(...params) : value;
}
-export {normalize, resolve};
+/**
+ * Quick indexOf replacement for checking the ignoreTags option
+ */
+export function contains(arr, value) {
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i] == value) { return true; }
+ }
+ return false;
+}
+
+function noop(val) {
+ return val;
+}
+
+function yes(val) {
+ return true;
+}
+
+function typeToTarget(href, type) {
+ return type === 'url' ? '_blank' : null;
+}
diff --git a/tasks/quick-es3.js b/tasks/quick-es3.js
new file mode 100644
index 00000000..e7cce214
--- /dev/null
+++ b/tasks/quick-es3.js
@@ -0,0 +1,14 @@
+'use strict';
+
+const replace = require('gulp-replace');
+const lazypipe = require('lazypipe');
+
+// HACK to convert linkify code to something more ES3-compatible for IE8
+module.exports = lazypipe()
+ .pipe(replace, /\.default([^a-zA-Z0-9])/g, '[\'default\']$1')
+ .pipe(replace, /([^a-zA-Z0-9\.])default:/g, '$1\'default\':')
+ .pipe(
+ replace,
+ /(Object\.defineProperty\(exports,\W*['"]__esModule['"],\W*\{\W*value:\W*true\W*\}\);)/g,
+ 'try { $1 } catch (e) { exports[\'__esModule\'] = true; }'
+ );
diff --git a/tasks/rollup.js b/tasks/rollup.js
index 8290ab32..f2bc2056 100644
--- a/tasks/rollup.js
+++ b/tasks/rollup.js
@@ -3,7 +3,7 @@
const util = require('gulp-util');
const through = require('through2');
const rollup = require('rollup').rollup;
-const extend = require('lodash').extend;
+const extend = require('lodash/extend');
const PluginError = util.PluginError;
const PLUGIN_NAME = 'gulp-rollup';
diff --git a/test/amd.conf.js b/test/amd.conf.js
new file mode 100644
index 00000000..b2567748
--- /dev/null
+++ b/test/amd.conf.js
@@ -0,0 +1,45 @@
+module.exports = {
+
+ // base path that will be used to resolve all patterns (eg. files, exclude)
+ basePath: __dirname.replace(/\/?test\/?$/, '/'),
+
+ // frameworks to use
+ // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+ frameworks: ['qunit'],
+
+ // list of files / patterns to load in the browser
+ files: [
+ 'node_modules/requirejs/require.js',
+ 'node_modules/jquery/dist/jquery.js',
+ 'build/linkify-polyfill.js',
+ 'build/linkify.amd.js',
+ 'build/*.amd.js',
+ 'test/qunit/amd.js',
+ 'test/qunit/main.js'
+ ],
+
+ // 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: ['dots'],
+
+ // web server port
+ port: 9876,
+
+ // enable / disable colors in the output (reporters and logs)
+ colors: true,
+
+ // enable / disable watching file and executing tests whenever any file changes
+ autoWatch: true,
+
+ // Continuous Integration mode
+ // if true, Karma captures browsers, runs the tests and exits
+ singleRun: false
+};
diff --git a/test/chrome.amd.conf.js b/test/chrome.amd.conf.js
new file mode 100644
index 00000000..a3c1f5af
--- /dev/null
+++ b/test/chrome.amd.conf.js
@@ -0,0 +1,18 @@
+// Karma Chrome configuration
+// Just opens Google Chrome for testing
+
+var
+base = require('./amd.conf'),
+extend = require('lodash/extend');
+
+module.exports = function (config) {
+
+ config.set(extend(base, {
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+ browsers: ['Chrome'],
+
+ }));
+};
diff --git a/test/chrome.conf.js b/test/chrome.conf.js
index f5fd1d39..8b767cc8 100644
--- a/test/chrome.conf.js
+++ b/test/chrome.conf.js
@@ -3,7 +3,7 @@
var
base = require('./conf'),
-extend = require('lodash').extend;
+extend = require('lodash/extend');
module.exports = function (config) {
diff --git a/test/ci.amd.conf.js b/test/ci.amd.conf.js
new file mode 100644
index 00000000..bf65eb9d
--- /dev/null
+++ b/test/ci.amd.conf.js
@@ -0,0 +1,67 @@
+// Karma CI configuration
+
+var
+base = require('./amd.conf'),
+extend = require('lodash/extend');
+
+module.exports = function (config) {
+
+ // Check out https://saucelabs.com/platforms for all browser/platform combos
+ var customLaunchers = {
+ sl_chrome: {
+ base: 'SauceLabs',
+ browserName: 'chrome',
+ version: '48'
+ },
+ sl_firefox: {
+ base: 'SauceLabs',
+ browserName: 'firefox',
+ version: '45'
+ },
+ sl_edge: {
+ base: 'SauceLabs',
+ browserName: 'MicrosoftEdge',
+ platform: 'Windows 10',
+ version: '13'
+ },
+ sl_ie_11: {
+ base: 'SauceLabs',
+ browserName: 'internet explorer',
+ platform: 'Windows 8.1',
+ version: '11'
+ },
+ sl_ie_9: {
+ base: 'SauceLabs',
+ browserName: 'internet explorer',
+ platform: 'Windows 7',
+ version: '9'
+ },
+ sl_ie_8: {
+ base: 'SauceLabs',
+ browserName: 'internet explorer',
+ platform: 'Windows 7',
+ version: '8'
+ }
+ };
+
+ config.set(extend(base, {
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ sauceLabs: {
+ testName: 'Linkify Browser AMD Tests',
+ browserDisconnectTimeout: 30000,
+ browserNoActivityTimeout: 30000,
+ browserDisconnectTolerance: 3
+ },
+ customLaunchers: customLaunchers,
+ browsers: Object.keys(customLaunchers),
+ autoWatch: false,
+ singleRun: true,
+ logLevel: config.LOG_WARN,
+ reporters: [
+ 'dots',
+ 'saucelabs'
+ ],
+ }));
+};
diff --git a/test/ci.conf.js b/test/ci.conf.js
index ff8dff45..1b4e6097 100644
--- a/test/ci.conf.js
+++ b/test/ci.conf.js
@@ -2,7 +2,7 @@
var
base = require('./conf'),
-extend = require('lodash').extend;
+extend = require('lodash/extend');
module.exports = function (config) {
@@ -11,18 +11,18 @@ module.exports = function (config) {
sl_chrome: {
base: 'SauceLabs',
browserName: 'chrome',
- version: '35'
+ version: '48'
},
sl_firefox: {
base: 'SauceLabs',
browserName: 'firefox',
- version: '30'
+ version: '45'
},
sl_edge: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
platform: 'Windows 10',
- version: '20.10240'
+ version: '13'
},
sl_ie_11: {
base: 'SauceLabs',
@@ -35,13 +35,13 @@ module.exports = function (config) {
browserName: 'internet explorer',
platform: 'Windows 7',
version: '9'
- }/*,
+ },
sl_ie_8: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 7',
version: '8'
- }*/
+ }
};
config.set(extend(base, {
@@ -49,7 +49,10 @@ module.exports = function (config) {
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
sauceLabs: {
- testName: 'Linkify Browser Tests'
+ testName: 'Linkify Browser Tests',
+ browserDisconnectTimeout: 30000,
+ browserNoActivityTimeout: 30000,
+ browserDisconnectTolerance: 3
},
customLaunchers: customLaunchers,
browsers: Object.keys(customLaunchers),
diff --git a/test/conf.js b/test/conf.js
index a54c66f1..66375aa7 100644
--- a/test/conf.js
+++ b/test/conf.js
@@ -3,62 +3,40 @@ module.exports = {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: __dirname.replace(/\/?test\/?$/, '/'),
-
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
- frameworks: ['mocha', 'browserify'],
-
+ frameworks: ['qunit'],
// list of files / patterns to load in the browser
files: [
- 'test/shim.js',
- 'lib/*.js',
- 'lib/**/*.js',
- 'test/init.js',
- 'test/spec/*.js',
- 'test/spec/**/*.js',
+ 'node_modules/jquery/dist/jquery.js',
+ 'build/linkify-polyfill.js',
+ 'build/linkify.js',
+ 'build/*.js',
+ 'test/qunit/globals.js',
+ 'test/qunit/main.js'
],
-
// list of files to exclude
exclude: [
+ 'build/*.amd.js'
],
-
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
- preprocessors: {
- 'test/shim.js': ['browserify'],
- 'lib/*.js': ['browserify'],
- 'lib/**/*.js': ['browserify'],
- 'test/init.js': ['browserify'],
- 'test/spec/*.js': ['browserify'],
- 'test/spec/**/*.js': ['browserify'],
- },
-
- browserify: {
- debug: false,
- ignore: ['jsdom'],
- transform: ['brfs'],
- configure: function (bundle) {
- bundle.ignore('jsdom');
- },
- },
+ preprocessors: {},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
- reporters: ['progress'],
-
+ reporters: ['dots'],
// web server port
port: 9876,
-
// enable / disable colors in the output (reporters and logs)
colors: true,
-
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
diff --git a/test/dev.amd.conf.js b/test/dev.amd.conf.js
new file mode 100644
index 00000000..c9a72530
--- /dev/null
+++ b/test/dev.amd.conf.js
@@ -0,0 +1,17 @@
+// Karma Development configuration
+
+var
+base = require('./amd.conf'),
+extend = require('lodash/extend');
+
+module.exports = function (config) {
+
+ config.set(extend(base, {
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+ browsers: ['PhantomJS'],
+
+ }));
+};
diff --git a/test/dev.conf.js b/test/dev.conf.js
index a5c01a89..5a60b9e6 100644
--- a/test/dev.conf.js
+++ b/test/dev.conf.js
@@ -2,7 +2,7 @@
var
base = require('./conf'),
-extend = require('lodash').extend;
+extend = require('lodash/extend');
module.exports = function (config) {
diff --git a/test/firefox.amd.conf.js b/test/firefox.amd.conf.js
new file mode 100644
index 00000000..03e53160
--- /dev/null
+++ b/test/firefox.amd.conf.js
@@ -0,0 +1,17 @@
+// Karma Chrome configuration
+// Just opens Google Chrome for testing
+
+var
+base = require('./amd.conf'),
+extend = require('lodash/extend');
+
+module.exports = function (config) {
+
+ config.set(extend(base, {
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+ browsers: ['Firefox']
+ }));
+};
diff --git a/test/firefox.conf.js b/test/firefox.conf.js
index b8018e18..e480dcee 100644
--- a/test/firefox.conf.js
+++ b/test/firefox.conf.js
@@ -3,7 +3,7 @@
var
base = require('./conf'),
-extend = require('lodash').extend;
+extend = require('lodash/extend');
module.exports = function (config) {
diff --git a/test/qunit/amd.html b/test/qunit/amd.html
deleted file mode 100644
index 04007d15..00000000
--- a/test/qunit/amd.html
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
Here\'s a nested github.com/SoapBox/linkifyjs paragraph
'; +var originalHtml = 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here is a nested github.com/SoapBox/linkifyjs paragraph
'; // Possible results with regular settings (will vary by browser) var linkifiedHtml = [ - 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here\'s a nested github.com/SoapBox/linkifyjs paragraph
', - 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here\'s a nested github.com/SoapBox/linkifyjs paragraph
', - 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here\'s a nested github.com/SoapBox/linkifyjs paragraph
' + 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here is a nested github.com/SoapBox/linkifyjs paragraph
', + 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here is a nested github.com/SoapBox/linkifyjs paragraph
', + 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here is a nested github.com/SoapBox/linkifyjs paragraph
', + 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right? \r\nHere is a nested github.com/SoapBox/linkifyjs paragraph
' // IE8 ]; // Possible results with overriden settings var linkifiedHtmlAlt = [ - 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here\'s a nested github.com/SoapBox/linkifyjs paragraph
', - 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here\'s a nested github.com/SoapBox/linkifyjs paragraph
', - 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here\'s a nested github.com/SoapBox/linkifyjs paragraph
', - 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here\'s a nested github.com/SoapBox/linkifyjs paragraph
' + 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here is a nested github.com/SoapBox/linkifyjs paragraph
', + 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here is a nested github.com/SoapBox/linkifyjs paragraph
', + 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here is a nested github.com/SoapBox/linkifyjs paragraph
', + 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right?Here is a nested github.com/SoapBox/linkifyjs paragraph
', + 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right? \r\nHere is a nested github.com/SoapBox/linkifyjs paragraph
', // IE8 + 'Hello here are some links to ftp://awesome.com/?where=this and localhost:8080, pretty neat right? \r\nHere is a nested github.com/SoapBox/linkifyjs paragraph
' // IE8, emulated ]; QUnit.module('linkify-jquery', { diff --git a/test/qunit/qunit b/test/qunit/qunit deleted file mode 120000 index 12600c57..00000000 --- a/test/qunit/qunit +++ /dev/null @@ -1 +0,0 @@ -../../node_modules/qunitjs/qunit \ No newline at end of file diff --git a/test/qunit/requirejs b/test/qunit/requirejs deleted file mode 120000 index 28b6d24d..00000000 --- a/test/qunit/requirejs +++ /dev/null @@ -1 +0,0 @@ -../../node_modules/requirejs \ No newline at end of file