diff --git a/.config/karma.conf.js b/.config/karma.conf.js deleted file mode 120000 index 524564e..0000000 --- a/.config/karma.conf.js +++ /dev/null @@ -1 +0,0 @@ -karma.dev.js \ No newline at end of file diff --git a/.config/karma.dev.js b/.config/karma.dev.js deleted file mode 100644 index 25003a4..0000000 --- a/.config/karma.dev.js +++ /dev/null @@ -1,64 +0,0 @@ -// Karma configuration -// Generated on Fri Jan 20 2017 18:29:42 GMT+0200 (EET) - -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: ['mocha', 'chai', 'browserify'], - - // list of files / patterns to load in the browser - files: [ - '../tests/**/*.js' - ], - - browserify: { - // debug makes it generate source maps - debug: 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: { - '../tests/**/*.js': ['browserify'] - }, - - // test results reporter to use - // possible values: 'dots', 'progress' - // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress', 'nyan'], - - // 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_ERROR, - - // enable / disable watching file and executing tests whenever any file changes - autoWatch: true, - - // start these browsers - // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ['PhantomJS'], - - // Continuous Integration mode - // if true, Karma captures browsers, runs the tests and exits - singleRun: false, - - // Concurrency level - // how many browser should be started simultaneous - concurrency: Infinity - }); -}; diff --git a/.eslintrc.json b/.eslintrc.json index cf7bd76..8d50af3 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,15 +5,17 @@ "standard", "promise" ], - "rules" : { - "semi" : [ "error", "always" ], + "rules": { + "semi": [ "error", "always" ], "standard/object-curly-even-spacing": [2, "either"] }, - "globals" : { - "describe" : true, - "it" : true, - "window" : true, - "document" : true, - "expect" : true + "globals": { + "describe": true, + "it": true, + "window": true, + "document": true, + "expect": true, + "beforeEach": true, + "afterEach": true } } \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 2c85294..2d724f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,11 @@ language: node_js +cache: + directories: + - node_modules +notifications: + email: false node_js: - - "6" + - '6' env: global: - secure: "fpfC91ZOYl1LqyddVgsX17gPCr4yKkr1XpaheGdPK5FkZTzxrJqMxmmr/tjFPuhqjj6TUWX8K+Ts03M/PWDJTtxu6UXFAGPB+1ValiZDl49oW+i8bDpqMMyMMtfPs2fOK6Pn976PVH4UJzFjiu6oxMz0rVkuzWswCqV4NkR+4wV8PmoBC3lgsmyGINL+9cPeZG80FVp/KFYKo7Uvfj/jtDay1bAa+NtUat9wxUdj4CzmVuMtrfQHy4bWALTf/HKesTPVBO2hdgtwBL/sTNHfC5JOp4c126AgPZxoIb6v4FuAHFmmUG6/M67y0X80vwhD61EqnCcCjcWRAI2achq2BqhnVj07tDEI6TBpXb9hdVSw4RJG1UKZ5eJbHG0F/+PPDDqmBSqfhQpy4jY2u4w4s/2nVDLK4k0FErBVmyqAMxEfB/bewYq8mArNfGs5tU7bEdy7QXX8Fior7TpRh64pWFyj9+gAezPfqcLEQtmJlt7Ri3Ve/lV4Xyb9b/aoqKONCCJ4+EIwsp21KME7nScp9aKy0KCIYTSAirjk9NRdrG/qBWvcbSnNr1IKAp3MZnCuiPmpKj3HYTRz6In9j7ZSxwi6ISGEUmSLjAnNU2IxS+twu9gX3Ey9FLRHYbDYHc67FP138Ca4WETWLRsJ9Y4mGFXrfy0uf9ysCo+0rort0vI=" @@ -8,3 +13,10 @@ install: - npm i script: - npm run test +before_script: + - npm prune +after_success: + - npm run semantic-release +branches: + except: + - /^v\d+\.\d+\.\d+$/ diff --git a/README.md b/README.md index 73666a0..c896b14 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ ### move-into-view -[![Build Status](https://img.shields.io/travis/linuxenko/move-into-view.svg?style=flat-square)](https://travis-ci.org/linuxenko/move-into-view) [![Coveralls](https://img.shields.io/coveralls/linuxenko/move-into-view/master.svg?style=flat-square)](https://coveralls.io/github/linuxenko/move-into-view) [![npm version](https://img.shields.io/npm/v/move-into-view.svg?style=flat-square)](https://www.npmjs.com/package/move-into-view) [![license](https://img.shields.io/github/license/linuxenko/move-into-view.svg?style=flat-square)]() [![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/) +[![Build Status](https://img.shields.io/travis/linuxenko/move-into-view.svg?style=flat-square)](https://travis-ci.org/linuxenko/move-into-view) [![Coveralls](https://img.shields.io/coveralls/linuxenko/move-into-view/master.svg?style=flat-square)](https://coveralls.io/github/linuxenko/move-into-view) [![npm version](https://img.shields.io/npm/v/move-into-view.svg?style=flat-square)](https://www.npmjs.com/package/move-into-view) [![license](https://img.shields.io/github/license/linuxenko/move-into-view.svg?style=flat-square)]() [![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release) diff --git a/index.js b/index.js new file mode 100644 index 0000000..0776332 --- /dev/null +++ b/index.js @@ -0,0 +1,14 @@ +/** + * Package: move-into-view + * + * Decription: Move element inside of its parent with + * configurable ratio. + * + * License MIT 2017 Svetlana Linuxenko + */ + +function MoveIntoView () { + +} + +module.exports = MoveIntoView; diff --git a/.config/karma.ci-conf.js b/karma.conf.js similarity index 91% rename from .config/karma.ci-conf.js rename to karma.conf.js index cabd2b9..76d2ef4 100644 --- a/.config/karma.ci-conf.js +++ b/karma.conf.js @@ -13,8 +13,8 @@ module.exports = function (config) { // list of files / patterns to load in the browser files: [ - '../lib/**/*.js', - '../tests/**/*.js' + './index.js', + './tests/*.js' ], browserify: { @@ -30,14 +30,14 @@ module.exports = function (config) { // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { - '../lib/**/*.js': ['browserify'], - '../tests/**/*.js': ['browserify'] + './index.js': ['browserify'], + './tests/*.js': ['browserify'] }, // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['coverage', 'coveralls'], + reporters: ['coverage', 'coveralls', 'progress'], // web server port port: 9876, diff --git a/package.json b/package.json index f0c8cd0..6e7c915 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,17 @@ { "name": "move-into-view", - "version": "0.0.1", + "version": "0.0.0-development", "description": "move-into-view is such as scroll-into-view but better.", "main": "index.js", "scripts": { "test": "npm run lint && npm run karma && codecov", - "karma": "karma start ./.config/karma.ci-conf.js", - "lint": "eslint ." + "karma": "karma start karma.conf.js", + "lint": "eslint .", + "semantic-release": "semantic-release pre && npm publish && semantic-release post" }, "repository": { "type": "git", - "url": "git+https://github.com/linuxenko/move-into-view.git" + "url": "https://github.com/linuxenko/move-into-view.git" }, "keywords": [ "scroll" @@ -42,6 +43,7 @@ "karma-nyan-reporter": "^0.2.5", "karma-phantomjs-launcher": "^1.0.2", "mocha": "^3.2.0", - "watchify": "^3.8.0" + "watchify": "^3.8.0", + "semantic-release": "^6.3.2" } } diff --git a/tests/css/reset.js b/tests/css/reset.js new file mode 100644 index 0000000..d91794e --- /dev/null +++ b/tests/css/reset.js @@ -0,0 +1,23 @@ +module.exports = { + '*': { + 'margin': '0px', + 'padding': '0px', + 'border': '0', + 'outline': '0', + 'vertical-align': 'baseline', + 'font': 'inherit' + }, + + 'body': { + 'font': 'sans-serif', + 'font-size': '16px' + }, + + 'html': { + 'box-sizing': 'border-box' + }, + + '*, *:before, *:after': { + 'box-sizing': 'inherit' + } +}; diff --git a/tests/element-setup.test.js b/tests/element-setup.test.js new file mode 100644 index 0000000..5dfbba8 --- /dev/null +++ b/tests/element-setup.test.js @@ -0,0 +1,23 @@ +var MoveIntoView = require('../'); +var expect = require('chai').expect; +var resetCSS = require('./css/reset'); + +var CSSTate = require('csstate'); +var cst = new CSSTate(); + +cst.rule(resetCSS); + +describe('Test element setup', function () { + beforeEach(function () { + cst.rule(resetCSS); + }); + + afterEach(function () { + cst.exit(); + }); + + it('should be to be', function () { + expect(MoveIntoView).to.be.exists; + }); +}); + diff --git a/tests/launcher.test.js b/tests/launcher.test.js deleted file mode 100644 index 3d0ce6c..0000000 --- a/tests/launcher.test.js +++ /dev/null @@ -1,5 +0,0 @@ -describe('Test launcher and mocks', function () { - it('should run 1 + 1 test', function () { - expect(1 + 1).to.be.equal(2); - }); -});