forked from michalsnik/aos
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
676b927
commit a084dd7
Showing
6 changed files
with
126 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
describe('setting: anchorPlacement', function() { | ||
beforeEach(() => { | ||
cy.visit('/index.html'); | ||
cy.viewport(1280, 700); | ||
}); | ||
|
||
context('global setting', () => { | ||
it('Should be respected by all elements', () => { | ||
cy.initAOS({ | ||
offset: 0, | ||
anchorPlacement: 'top-center' | ||
}); | ||
|
||
cy.get('.aos-animate').should('have.length', 6); | ||
|
||
cy.scrollTo(0, 300); | ||
cy.get('.aos-animate').should('have.length', 9); | ||
}); | ||
|
||
it('Should respect default offset', () => { | ||
cy.initAOS({ | ||
offset: 120, | ||
anchorPlacement: 'top-center' | ||
}); | ||
|
||
cy.get('.aos-animate').should('have.length', 3); | ||
|
||
cy.scrollTo(0, 120); | ||
cy.get('.aos-animate').should('have.length', 6); | ||
}); | ||
}); | ||
|
||
context('inline setting', () => { | ||
it('Should override global setting and reset default offset', () => { | ||
cy.document().then(document => { | ||
const el = document.querySelector('[data-id="6"]'); | ||
el.dataset.aosAnchorPlacement = 'bottom-center'; | ||
}); | ||
|
||
cy.initAOS({ | ||
offset: 400, | ||
anchorPlacement: 'top-center' | ||
}); | ||
|
||
cy.get('[data-id="6"]').should('not.have.class', 'aos-animate'); | ||
|
||
cy.scrollTo(0, 290); | ||
cy.get('[data-id="6"]').should('not.have.class', 'aos-animate'); | ||
|
||
cy.scrollTo(0, 300); | ||
cy.get('[data-id="6"]').should('have.class', 'aos-animate'); | ||
}); | ||
|
||
it('Should respect inline offset', () => { | ||
cy.document().then(document => { | ||
const el = document.querySelector('[data-id="6"]'); | ||
el.dataset.aosAnchorPlacement = 'bottom-center'; | ||
el.dataset.aosOffset = 100; | ||
}); | ||
|
||
cy.initAOS({ | ||
offset: 400, | ||
anchorPlacement: 'top-center' | ||
}); | ||
|
||
cy.get('[data-id="6"]').should('not.have.class', 'aos-animate'); | ||
|
||
cy.scrollTo(0, 300); | ||
cy.get('[data-id="6"]').should('not.have.class', 'aos-animate'); | ||
|
||
cy.scrollTo(0, 400); | ||
cy.get('[data-id="6"]').should('have.class', 'aos-animate'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
module.exports = (on, config) => {}; | ||
module.exports = (on, config) => { | ||
on('before:browser:launch', (browser = {}, args) => { | ||
console.log(browser, args); // see what all is in here! | ||
|
||
if (browser.name === 'chrome') { | ||
args.push('--disable-gpu'); | ||
return args; | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters