hexo
This commit is contained in:
23
themes/next/test/.jshintrc
Normal file
23
themes/next/test/.jshintrc
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"curly": true,
|
||||
"eqnull": true,
|
||||
"eqeqeq": true,
|
||||
"undef": true,
|
||||
"newcap": true,
|
||||
"unused": true,
|
||||
"laxcomma": false,
|
||||
"asi": false,
|
||||
"expr": true,
|
||||
"loopfunc": false,
|
||||
"strict": false,
|
||||
|
||||
"globals": {
|
||||
"define": true,
|
||||
"require": true,
|
||||
"it": true,
|
||||
"module": true,
|
||||
"describe": true,
|
||||
"window": true,
|
||||
"$": true
|
||||
}
|
||||
}
|
133
themes/next/test/helpers.js
Normal file
133
themes/next/test/helpers.js
Normal file
@ -0,0 +1,133 @@
|
||||
define([
|
||||
'intern!object',
|
||||
'intern/chai!assert',
|
||||
'intern/order!source/js/helpers.js'
|
||||
], function (registerSuite, assert) {
|
||||
registerSuite({
|
||||
name: 'helpers',
|
||||
|
||||
beforeEach: function () {
|
||||
window = {
|
||||
navigator: {
|
||||
userAgent: ''
|
||||
}
|
||||
};
|
||||
screen = {
|
||||
width: 0
|
||||
};
|
||||
|
||||
minic = {
|
||||
desktop: function (screenWidth) {
|
||||
window.navigator.userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36';
|
||||
screen.width = screenWidth || 992;
|
||||
},
|
||||
tablet: function (screenWidth) {
|
||||
window.navigator.userAgent = 'Mozilla/5.0 (iPad; CPU OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5';
|
||||
screen.width = screenWidth || 750;
|
||||
},
|
||||
mobile: function (screenWidth) {
|
||||
window.navigator.userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4';
|
||||
screen.width = screenWidth || 767;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
'#hasMobileUA': {
|
||||
'should be true': function () {
|
||||
minic.mobile();
|
||||
assert.isTrue( hasMobileUA() );
|
||||
minic.tablet();
|
||||
assert.isTrue( hasMobileUA() );
|
||||
},
|
||||
|
||||
'should be false': function () {
|
||||
minic.desktop();
|
||||
assert.isFalse( hasMobileUA() );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
'#isDesktop': {
|
||||
'should be true': function () {
|
||||
minic.desktop(992);
|
||||
assert.isTrue( isDesktop() );
|
||||
|
||||
minic.desktop(1200);
|
||||
assert.isTrue( isDesktop() );
|
||||
},
|
||||
'should be false': function () {
|
||||
minic.mobile();
|
||||
assert.isFalse( isDesktop() );
|
||||
|
||||
minic.tablet(992);
|
||||
assert.isFalse( isDesktop() );
|
||||
}
|
||||
},
|
||||
|
||||
'#isTablet': {
|
||||
'should be true': function () {
|
||||
minic.tablet(900);
|
||||
assert.isTrue( isTablet() );
|
||||
|
||||
minic.tablet(780);
|
||||
assert.isTrue( isTablet() );
|
||||
},
|
||||
'should be false': function () {
|
||||
minic.desktop(500);
|
||||
assert.isFalse( isTablet() );
|
||||
|
||||
minic.tablet(1000);
|
||||
assert.isFalse( isTablet() );
|
||||
|
||||
minic.tablet(500);
|
||||
assert.isFalse( isTablet() );
|
||||
}
|
||||
},
|
||||
|
||||
'#isMobile': {
|
||||
'should be true': function () {
|
||||
minic.mobile();
|
||||
assert.isTrue( isMobile() );
|
||||
|
||||
minic.mobile(700);
|
||||
assert.isTrue( isMobile() );
|
||||
},
|
||||
'should be false': function () {
|
||||
minic.desktop();
|
||||
assert.isFalse( isMobile() );
|
||||
|
||||
minic.tablet();
|
||||
assert.isFalse( isMobile() );
|
||||
|
||||
minic.mobile(1000);
|
||||
assert.isFalse( isMobile() );
|
||||
}
|
||||
},
|
||||
|
||||
'#escapeSelector': function () {
|
||||
var selectors = ['(something', '.something', '$something'];
|
||||
selectors.forEach(function (s) {
|
||||
assert.equal( escapeSelector(s), '\\' + s );
|
||||
});
|
||||
},
|
||||
|
||||
'#displaySidebar': function () {},
|
||||
|
||||
'#isMist': {
|
||||
beforeEach: function () {
|
||||
CONFIG = {
|
||||
scheme: ''
|
||||
};
|
||||
},
|
||||
'should be true': function () {
|
||||
CONFIG.scheme = 'Mist';
|
||||
assert.isTrue( isMist() );
|
||||
},
|
||||
'should be false': function () {
|
||||
CONFIG.scheme = 'Minimal';
|
||||
assert.isFalse( isMist() );
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
65
themes/next/test/intern.js
Normal file
65
themes/next/test/intern.js
Normal file
@ -0,0 +1,65 @@
|
||||
// Learn more about configuring this file at <https://github.com/theintern/intern/wiki/Configuring-Intern>.
|
||||
// These default settings work OK for most people. The options that *must* be changed below are the
|
||||
// packages, suites, excludeInstrumentation, and (if you want functional tests) functionalSuites.
|
||||
define({
|
||||
// The port on which the instrumenting proxy will listen
|
||||
proxyPort: 9000,
|
||||
|
||||
// A fully qualified URL to the Intern proxy
|
||||
proxyUrl: 'http://localhost:9000/',
|
||||
|
||||
// Default desired capabilities for all environments. Individual capabilities can be overridden by any of the
|
||||
// specified browser environments in the `environments` array below as well. See
|
||||
// https://code.google.com/p/selenium/wiki/DesiredCapabilities for standard Selenium capabilities and
|
||||
// https://saucelabs.com/docs/additional-config#desired-capabilities for Sauce Labs capabilities.
|
||||
// Note that the `build` capability will be filled in with the current commit ID from the Travis CI environment
|
||||
// automatically
|
||||
capabilities: {
|
||||
'selenium-version': '2.41.0'
|
||||
},
|
||||
|
||||
// Browsers to run integration testing against. Note that version numbers must be strings if used with Sauce
|
||||
// OnDemand. Options that will be permutated are browserName, version, platform, and platformVersion; any other
|
||||
// capabilities options specified for an environment will be copied as-is
|
||||
environments: [
|
||||
{ browserName: 'internet explorer', version: '11', platform: 'Windows 8.1' },
|
||||
{ browserName: 'internet explorer', version: '10', platform: 'Windows 8' },
|
||||
{ browserName: 'internet explorer', version: '9', platform: 'Windows 7' },
|
||||
{ browserName: 'firefox', version: '28', platform: [ 'OS X 10.9', 'Windows 7', 'Linux' ] },
|
||||
{ browserName: 'chrome', version: '34', platform: [ 'OS X 10.9', 'Windows 7', 'Linux' ] },
|
||||
{ browserName: 'safari', version: '6', platform: 'OS X 10.8' },
|
||||
{ browserName: 'safari', version: '7', platform: 'OS X 10.9' }
|
||||
],
|
||||
|
||||
// Maximum number of simultaneous integration tests that should be executed on the remote WebDriver service
|
||||
maxConcurrency: 3,
|
||||
|
||||
// Name of the tunnel class to use for WebDriver tests
|
||||
tunnel: 'SauceLabsTunnel',
|
||||
|
||||
// The desired AMD loader to use when running unit tests (client.html/client.js). Omit to use the default Dojo
|
||||
// loader
|
||||
useLoader: {
|
||||
'host-node': 'dojo/dojo',
|
||||
'host-browser': 'node_modules/dojo/dojo.js'
|
||||
},
|
||||
|
||||
// Configuration options for the module loader; any AMD configuration options supported by the specified AMD loader
|
||||
// can be used here
|
||||
loader: {
|
||||
// Packages that should be registered with the loader in each testing environment
|
||||
packages: [ { name: 'next', location: '.' } ]
|
||||
},
|
||||
|
||||
// Non-functional test suite(s) to run in each browser
|
||||
suites: [
|
||||
/* 'myPackage/tests/foo', 'myPackage/tests/bar' */
|
||||
'tests/helpers'
|
||||
],
|
||||
|
||||
// Functional test suite(s) to run in each browser once non-functional tests are completed
|
||||
functionalSuites: [ /* 'myPackage/tests/functional' */ ],
|
||||
|
||||
// A regular expression matching URLs to files that should not be included in code coverage analysis
|
||||
excludeInstrumentation: /^(?:tests|node_modules)\//
|
||||
});
|
Reference in New Issue
Block a user