Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
michalsnik committed May 19, 2018
1 parent 94e3255 commit e5f3252
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 42 deletions.
24 changes: 18 additions & 6 deletions cypress/integration/aos_spec.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
describe('AOS', function () {
describe('AOS', function() {
before(() => {
cy.visit('/');
cy.initAOS();
});

it('Should be defined', function() {
cy.window().its('AOS').should('exist');
cy
.window()
.its('AOS')
.should('exist');
});

it('Should have init method', function() {
cy.window().its('AOS.init').should('exist');
cy
.window()
.its('AOS.init')
.should('exist');
});

it('Should have refresh method', function() {
cy.window().its('AOS.refresh').should('exist');
cy
.window()
.its('AOS.refresh')
.should('exist');
});

it('Should have refreshHard method', function() {
cy.window().its('AOS.refreshHard').should('exist');
cy
.window()
.its('AOS.refreshHard')
.should('exist');
});

it('Should add aos-init class on all elements', function() {
Expand Down Expand Up @@ -52,7 +64,7 @@ describe('AOS', function () {
cy.scrollTo(0, 450);
cy.get('.aos-animate').should('have.length', 6);

cy.scrollTo('top')
cy.scrollTo('top');
cy.get('.aos-animate').should('have.length', 2);

cy.viewport(1280, 720);
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/mutation_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('mutation observer', function () {
describe('mutation observer', function() {
before(() => {
cy.visit('/async.html');
cy.initAOS();
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/settings_anchor_spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
describe('setting: anchor', function () {
describe('setting: anchor', function() {
before(() => {
cy.visit('/anchor.html');
cy.viewport(1280, 700);
cy.initAOS({
offset: 0,
offset: 0
});
});

Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/settings_delay_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('setting: delay', function () {
describe('setting: delay', function() {
before(() => {
cy.visit('/');
});
Expand All @@ -10,7 +10,7 @@ describe('setting: delay', function () {

it('Should respect global delay setting and set attribue on body', function() {
cy.initAOS({
delay: 100,
delay: 100
});
cy.get('body').should('have.attr', 'data-aos-delay', '100');
});
Expand Down
6 changes: 3 additions & 3 deletions cypress/integration/settings_disable_spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
describe('setting: disable', function () {
describe('setting: disable', function() {
beforeEach(() => {
cy.visit('/');
});

it('Should properly disable AOS', function() {
cy.initAOS({
disable: true,
disable: true
});

cy.get('.aos-item[data-aos]').should('have.length', 0);
Expand All @@ -18,7 +18,7 @@ describe('setting: disable', function () {

cy.window().then(({ AOS, innerWidth }) => {
AOS.init({
disable: () => innerWidth < 400,
disable: () => innerWidth < 400
});
});

Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/settings_duration_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('setting: duration', function () {
describe('setting: duration', function() {
before(() => {
cy.visit('/');
});
Expand All @@ -10,7 +10,7 @@ describe('setting: duration', function () {

it('Should respect global duration setting and set attribue on body', function() {
cy.initAOS({
duration: 2000,
duration: 2000
});
cy.get('body').should('have.attr', 'data-aos-duration', '2000');
});
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/settings_easing_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('setting: easing', function () {
describe('setting: easing', function() {
before(() => {
cy.visit('/');
});
Expand All @@ -10,7 +10,7 @@ describe('setting: easing', function () {

it('Should respect global easing setting and set attribue on body', function() {
cy.initAOS({
easing: 'ease-in-sine',
easing: 'ease-in-sine'
});
cy.get('body').should('have.attr', 'data-aos-easing', 'ease-in-sine');
});
Expand Down
6 changes: 3 additions & 3 deletions cypress/integration/settings_offset_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('setting: offset', function () {
describe('setting: offset', function() {
context('global', () => {
before(() => {
cy.visit('/');
Expand All @@ -7,7 +7,7 @@ describe('setting: offset', function () {
context('400px', () => {
before(() => {
cy.initAOS({
offset: 400,
offset: 400
});
});

Expand All @@ -24,7 +24,7 @@ describe('setting: offset', function () {
context('0px', () => {
before(() => {
cy.initAOS({
offset: 0,
offset: 0
});
});

Expand Down
29 changes: 22 additions & 7 deletions cypress/integration/settings_once_spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
describe('setting: once', function () {
describe('setting: once', function() {
context('global', () => {
before(() => {
cy.visit('/');
cy.initAOS({
once: true,
once: true
});
});

Expand Down Expand Up @@ -46,11 +46,26 @@ describe('setting: once', function () {
it('Should not remove aos-animate class after scrolling up', () => {
cy.scrollTo(0, 0);
cy.get('.aos-animate').should('have.length', 11);
cy.get('.aos-init').eq(8).should('have.class', 'aos-animate');
cy.get('.aos-init').eq(10).should('have.class', 'aos-animate');
cy.get('.aos-init').eq(12).should('have.class', 'aos-animate');
cy.get('.aos-init').eq(16).should('have.class', 'aos-animate');
cy.get('.aos-init').eq(20).should('have.class', 'aos-animate');
cy
.get('.aos-init')
.eq(8)
.should('have.class', 'aos-animate');
cy
.get('.aos-init')
.eq(10)
.should('have.class', 'aos-animate');
cy
.get('.aos-init')
.eq(12)
.should('have.class', 'aos-animate');
cy
.get('.aos-init')
.eq(16)
.should('have.class', 'aos-animate');
cy
.get('.aos-init')
.eq(20)
.should('have.class', 'aos-animate');
});
});
});
13 changes: 6 additions & 7 deletions cypress/integration/settings_startEvent_spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
describe('setting: startEvent', function () {
describe('setting: startEvent', function() {
beforeEach(() => {
cy.visit('/');
});

it('Should allow to initialize AOS on custom event', function() {
cy.initAOS({
startEvent: 'customEvent',
startEvent: 'customEvent'
});

cy.get('.aos-init').should('have.length', 0);
Expand All @@ -15,18 +15,17 @@ describe('setting: startEvent', function () {

it('Should properly initialize on "load" event', function() {
cy.initAOS({
startEvent: 'load',
startEvent: 'load'
});

cy.window().then(window =>
window.dispatchEvent(new Event('load')));
cy.window().then(window => window.dispatchEvent(new Event('load')));

cy.get('.aos-init').should('have.length', 24);
});

it('Shouldn\'t initialize when event is not dispatched', function() {
it("Shouldn't initialize when event is not dispatched", function() {
cy.initAOS({
startEvent: 'another-event-name',
startEvent: 'another-event-name'
});

cy.get('.aos-init').should('have.length', 0);
Expand Down
2 changes: 1 addition & 1 deletion cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = (on, config) => {}
module.exports = (on, config) => {};
2 changes: 1 addition & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cypress.Commands.add('initAOS', (settings) => {
Cypress.Commands.add('initAOS', settings => {
cy.window().then(({ AOS }) => {
AOS.init(settings);
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import './commands'
import './commands';
8 changes: 4 additions & 4 deletions scripts/start-server.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const liveServer = require('live-server');

const params = {
port: 8080,
host: '0.0.0.0',
port: 8080,
host: '0.0.0.0',
root: './demo',
watch: ['dist/**', 'demo/**'],
open: process.env.NODE_ENV !== 'test',
open: process.env.NODE_ENV !== 'test',
mount: [['/dist', './dist']],
noCssInject: true,
noCssInject: true
};

const server = liveServer.start(params);
Expand Down

0 comments on commit e5f3252

Please sign in to comment.