Skip to content

Commit

Permalink
try should instead of then
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbreiding committed Sep 24, 2019
1 parent 72c543e commit 91fdbde
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,71 +87,71 @@ describe "src/cy/commands/actions/scroll", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo("topLeft").then () ->
cy.get("#scroll-to-both").scrollTo("topLeft").should ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

it "scrolls x/y axis to top", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo("top").then () ->
cy.get("#scroll-to-both").scrollTo("top").should ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq((500-100)/2)

it "scrolls x/y axis to topRight", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo("topRight").then () ->
cy.get("#scroll-to-both").scrollTo("topRight").should ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq((500-100))

it "scrolls x/y axis to left", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo("left").then () ->
cy.get("#scroll-to-both").scrollTo("left").should ->
expect(@scrollBoth.get(0).scrollTop).to.eq((500-100)/2)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

it "scrolls x/y axis to center", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo("center").then () ->
cy.get("#scroll-to-both").scrollTo("center").should ->
expect(@scrollBoth.get(0).scrollTop).to.eq((500-100)/2)
expect(@scrollBoth.get(0).scrollLeft).to.eq((500-100)/2)

it "scrolls x/y axis to right", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo("right").then () ->
cy.get("#scroll-to-both").scrollTo("right").should ->
expect(@scrollBoth.get(0).scrollTop).to.eq((500-100)/2)
expect(@scrollBoth.get(0).scrollLeft).to.eq((500-100))

it "scrolls x/y axis to bottomLeft", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo("bottomLeft").then () ->
cy.get("#scroll-to-both").scrollTo("bottomLeft").should ->
expect(@scrollBoth.get(0).scrollTop).to.eq((500-100))
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

it "scrolls x/y axis to bottom", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo("bottom").then () ->
cy.get("#scroll-to-both").scrollTo("bottom").should ->
expect(@scrollBoth.get(0).scrollTop).to.eq((500-100))
expect(@scrollBoth.get(0).scrollLeft).to.eq((500-100)/2)

it "scrolls x/y axis to bottomRight", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo("bottomRight").then () ->
cy.get("#scroll-to-both").scrollTo("bottomRight").should ->
expect(@scrollBoth.get(0).scrollTop).to.eq((500-100))
expect(@scrollBoth.get(0).scrollLeft).to.eq((500-100))

Expand All @@ -160,55 +160,55 @@ describe "src/cy/commands/actions/scroll", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo(300, 150).then ($el) ->
cy.get("#scroll-to-both").scrollTo(300, 150).should ($el) ->
expect(@scrollBoth.get(0).scrollTop).to.eq(150)
expect(@scrollBoth.get(0).scrollLeft).to.eq(300)

it "scrolls x to 0 and y num of px", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo(0, 150).then ($el) ->
cy.get("#scroll-to-both").scrollTo(0, 150).should ($el) ->
expect(@scrollBoth.get(0).scrollTop).to.eq(150)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

it "scrolls x num of px and y to 0 ", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo(150, 0).then ($el) ->
cy.get("#scroll-to-both").scrollTo(150, 0).should ($el) ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(150)

it "scrolls both x and y axis of px", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo("300px", "150px").then ($el) ->
cy.get("#scroll-to-both").scrollTo("300px", "150px").should ($el) ->
expect(@scrollBoth.get(0).scrollTop).to.eq(150)
expect(@scrollBoth.get(0).scrollLeft).to.eq(300)

it "scrolls both x and y axis of percentage", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo("50%", "50%").then ($el) ->
cy.get("#scroll-to-both").scrollTo("50%", "50%").should ($el) ->
expect(@scrollBoth.get(0).scrollTop).to.eq((500-100)/2)
expect(@scrollBoth.get(0).scrollLeft).to.eq((500-100)/2)

it "scrolls x to 0 and y percentage", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo("0%", "50%").then ($el) ->
cy.get("#scroll-to-both").scrollTo("0%", "50%").should ($el) ->
expect(@scrollBoth.get(0).scrollTop).to.eq((500-100)/2)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

it "scrolls x to percentage and y to 0", ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq(0)

cy.get("#scroll-to-both").scrollTo("50%", "0%").then ($el) ->
cy.get("#scroll-to-both").scrollTo("50%", "0%").should ($el) ->
expect(@scrollBoth.get(0).scrollTop).to.eq(0)
expect(@scrollBoth.get(0).scrollLeft).to.eq((500-100)/2)

Expand Down

0 comments on commit 91fdbde

Please sign in to comment.