Skip to content

Commit

Permalink
use babel for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Aug 10, 2016
1 parent 51a1d10 commit 9d0ecc0
Show file tree
Hide file tree
Showing 9 changed files with 308 additions and 260 deletions.
3 changes: 3 additions & 0 deletions .babelrc
@@ -0,0 +1,3 @@
{
"presets": ["modern-node/6.3", "es2016", "stage-1"]
}
3 changes: 3 additions & 0 deletions .eslintrc.json
Expand Up @@ -5,5 +5,8 @@
"arrow-parens": [2, "as-needed"],
"curly": [2, "all"],
"import/no-unresolved": 0
},
"env": {
"browser": true
}
}
27 changes: 2 additions & 25 deletions Gruntfile.coffee
Expand Up @@ -7,17 +7,7 @@ module.exports = (grunt) ->
meta:
banner: '/* <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */\n'
eslint:
target: ['src']
coffeelint:
src: 'src/**/*.coffee'
options:
max_line_length:
level: 'ignore'
line_endings:
value: 'unix'
level: 'error'
no_stand_alone_at:
level: 'error'
target: ['src', 'test']
clean:
options:
force: true
Expand All @@ -36,19 +26,6 @@ module.exports = (grunt) ->
options:
presets: ["es2015", "es2016", "stage-1"]
plugins: ["add-module-exports", "transform-es2015-modules-umd"]
coffee:
compile:
files: [
{
expand: true
cwd: 'src/'
src: '**/*.coffee'
dest: 'compile/'
ext: '.js'
}
],
options:
bare: true
concat:
options:
banner: '<%= meta.banner %>'
Expand Down Expand Up @@ -93,7 +70,7 @@ module.exports = (grunt) ->
else done()
)

grunt.registerTask 'default', ['eslint', 'coffeelint', 'clean', 'babel', 'coffee', 'concat', 'uglify']
grunt.registerTask 'default', ['eslint', 'clean', 'babel', 'concat', 'uglify']
grunt.registerTask 'test:protractor-local', [
'default',
'webdriver',
Expand Down
21 changes: 11 additions & 10 deletions package.json
Expand Up @@ -27,25 +27,26 @@
"license": "MIT",
"readmeFilename": "README.md",
"devDependencies": {
"babel-eslint": "^6.1.0",
"babel-eslint": "^6.1.2",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-es2015-modules-umd": "^6.8.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-es2016": "^6.11.0",
"babel-preset-stage-1": "^6.5.0",
"babel-plugin-transform-es2015-modules-umd": "^6.12.0",
"babel-preset-es2015": "^6.13.2",
"babel-preset-es2016": "^6.11.3",
"babel-preset-modern-node": "^2.3.0",
"babel-preset-stage-1": "^6.13.0",
"babel-register": "^6.11.6",
"coffee-script": "~1.8.0",
"eslint-config-airbnb-base": "^3.0.1",
"eslint-plugin-import": "^1.10.0",
"eslint": "^3.2.2",
"eslint-config-airbnb-base": "^5.0.1",
"eslint-plugin-import": "^1.12.0",
"grunt": "~0.4.5",
"grunt-babel": "^6.0.0",
"grunt-cli": "^1.2.0",
"grunt-coffeelint": "~0.0.13",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-coffee": "~0.12.0",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-connect": "0.8.0",
"grunt-contrib-uglify": "~0.6.0",
"grunt-eslint": "^18.1.0",
"grunt-eslint": "^19.0.0",
"grunt-protractor-runner": "1.1.4",
"load-grunt-tasks": "^3.5.0",
"mkdirp": "0.5.0",
Expand Down
4 changes: 2 additions & 2 deletions src/infinite-scroll.js
Expand Up @@ -72,15 +72,15 @@ angular.module(MODULE_NAME, [])
if (offsetTop(container) !== undefined) {
containerTopOffset = offsetTop(container);
}
elementBottom = offsetTop(elem) - containerTopOffset + height(elem);
elementBottom = (offsetTop(elem) - containerTopOffset) + height(elem);
}

if (useDocumentBottom) {
elementBottom = height((elem[0].ownerDocument || elem[0].document).documentElement);
}

const remaining = elementBottom - containerBottom;
const shouldScroll = remaining <= height(container) * scrollDistance + 1;
const shouldScroll = remaining <= (height(container) * scrollDistance) + 1;

if (shouldScroll) {
checkWhenEnabled = true;
Expand Down
14 changes: 14 additions & 0 deletions test/.eslintrc.json
@@ -0,0 +1,14 @@
{
"env": {
"protractor": true,
"mocha": true
},
"globals": {
"expect": false
},
"rules": {
"import/no-extraneous-dependencies": 0,
"prefer-arrow-callback": 0,
"func-names": 0
}
}
6 changes: 4 additions & 2 deletions test/protractor.conf.js
@@ -1,12 +1,14 @@
require('babel-register');

exports.config = {
specs: ['**/*.spec.coffee'],
specs: ['**/*.spec.js'],
baseUrl: 'http://localhost:8000/',
allScriptsTimeout: 30000,
getPageTimeout: 30000,
multiCapabilities: [
{
browserName: 'chrome',
chromeOptions: { args: ['--no-sandbox'] },
}
},
],
};
221 changes: 0 additions & 221 deletions test/spec/ng-infinite-scroll.spec.coffee

This file was deleted.

0 comments on commit 9d0ecc0

Please sign in to comment.