From 6ac12ca1ebf7b303705f7379d2c0c86f94b65cdb Mon Sep 17 00:00:00 2001 From: Svetlana Linuxenko Date: Sun, 5 Mar 2017 18:08:01 +0200 Subject: [PATCH 1/4] Semantic release support --- .travis.yml | 16 +++++++++++++++- README.md | 2 +- package.json | 10 ++++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2c85294..1b84b6d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,13 @@ language: node_js +cache: + directories: + - node_modules +notifications: + email: false node_js: - - "6" + - '7' + - '6' + - '4' 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 +15,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/package.json b/package.json index f0c8cd0..528c365 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 ." + "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" } } From 066d2dd662d66ac57a65ba538f9011ced6aa8387 Mon Sep 17 00:00:00 2001 From: Svetlana Linuxenko Date: Thu, 23 Mar 2017 21:12:16 +0200 Subject: [PATCH 2/4] One node build (travis) --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1b84b6d..2d724f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,7 @@ cache: notifications: email: false node_js: - - '7' - '6' - - '4' 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=" From ff69eec78cc19bede11c37d859c3f9ba6d72da81 Mon Sep 17 00:00:00 2001 From: Svetlana Linuxenko Date: Thu, 23 Mar 2017 22:10:37 +0200 Subject: [PATCH 3/4] Setup karma --- .config/karma.conf.js | 1 - .config/karma.dev.js | 64 ----------------------- index.js | 0 .config/karma.ci-conf.js => karma.conf.js | 10 ++-- package.json | 2 +- tests/element-setup.test.js | 9 ++++ tests/launcher.test.js | 5 -- 7 files changed, 15 insertions(+), 76 deletions(-) delete mode 120000 .config/karma.conf.js delete mode 100644 .config/karma.dev.js create mode 100644 index.js rename .config/karma.ci-conf.js => karma.conf.js (91%) create mode 100644 tests/element-setup.test.js delete mode 100644 tests/launcher.test.js 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/index.js b/index.js new file mode 100644 index 0000000..e69de29 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 528c365..6e7c915 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "test": "npm run lint && npm run karma && codecov", - "karma": "karma start ./.config/karma.ci-conf.js", + "karma": "karma start karma.conf.js", "lint": "eslint .", "semantic-release": "semantic-release pre && npm publish && semantic-release post" }, diff --git a/tests/element-setup.test.js b/tests/element-setup.test.js new file mode 100644 index 0000000..edd13cc --- /dev/null +++ b/tests/element-setup.test.js @@ -0,0 +1,9 @@ +var MoveIntoView = require('../'); +var expect = require('chai').expect; + +describe('Test element setup', function () { + 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); - }); -}); From 0fb8ba0acf4f4523b11507cd8ca4e7d13e7cecd6 Mon Sep 17 00:00:00 2001 From: Svetlana Linuxenko Date: Sun, 26 Mar 2017 13:56:04 +0300 Subject: [PATCH 4/4] Setup csstate --- .eslintrc.json | 18 ++++++++++-------- index.js | 14 ++++++++++++++ tests/css/reset.js | 23 +++++++++++++++++++++++ tests/element-setup.test.js | 14 ++++++++++++++ 4 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 tests/css/reset.js 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/index.js b/index.js index e69de29..0776332 100644 --- a/index.js +++ 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/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 index edd13cc..5dfbba8 100644 --- a/tests/element-setup.test.js +++ b/tests/element-setup.test.js @@ -1,7 +1,21 @@ 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; });