You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.
evaluate_ruby { ... } # evaluates block and returns result
expect_evaluate_ruby { ... }.to be >= 12 # runs block on client and then checks result
expect_promise { ... }.to be >= 12 # runs block on client, and waits for the promise to resolve
evaluate_ruby should become on_client, shorter and clearer.
Given this should
expect_evaluate_ruby become expect_on_client and expect_promise stays as is
or expect { ... }.on_client and expect { ... }.promises ??
some examples:
require"spec_helper"RSpec::Steps.steps"Element#css",js: truedobefore(:step)doinsert_html<<-HTML<divid="foo" style="background-color:rgb(15,99,30); color:;"></div><divid="bar"></div><divid="hash"></div><divid="animate-foo"></div><divid="effects-foo"></div> HTMLendit"with a given name: returns the value of the CSS property for the given name"doexpectdoElement.find('#foo').css('backgroundColor')end.on_client.toeq('rgb(15, 99, 30)')end# it "with a given name: should return an empty string when no style property is defined for name"# the above is not true (at least not any more). All css properties that I know of have a defined# default value. I.e. no color = rgb(0,0,0)it"with a name and value: should set the CSS property to the given value"doon_clientdoElement.find('#bar').css('backgroundColor','blue')endexpect(find('#bar',visible: false).native.css_value('background-color')).toeq('rgba(0, 0, 255, 1)')endit"with a name and value: returns self"doexpectdobar=Element.find('#bar')bar.css("background","green") == barend.on_client.tobe_truthyendit"with a set of names and values: should set the properties"doon_clientdohash=Element.find("#hash")hash.css(:width=>"100px",:height=>"200px")endexpect(find('#hash',visible: false).native.css_value('width')).toeq('100px')expect(find('#hash',visible: false).native.css_value('height')).toeq('200px')endit"with a set of names and values: should return self"doexpectdohash=Element.find("#hash")hash.css(:border=>"1px solid #000") == hashend.on_client.tobe_truthyendit"animation should accept a block as a callback"doon_clientdostart_time=Time.nowfoo=find('#animate-foo')foo.animate:width=>"200px"do@animated.resolve!Time.now - start_timeendendexpect_promise{@animated=Promise.new}.tobe >= 0.4endend
or
require"spec_helper"RSpec::Steps.steps"Element#css",js: truedobefore(:step)doinsert_html<<-HTML<divid="foo" style="background-color:rgb(15,99,30); color:;"></div><divid="bar"></div><divid="hash"></div><divid="animate-foo"></div><divid="effects-foo"></div> HTMLendit"with a given name: returns the value of the CSS property for the given name"doexpect_on_clientdoElement.find('#foo').css('backgroundColor')end.toeq('rgb(15, 99, 30)')end# it "with a given name: should return an empty string when no style property is defined for name"# the above is not true (at least not any more). All css properties that I know of have a defined# default value. I.e. no color = rgb(0,0,0)it"with a name and value: should set the CSS property to the given value"doon_clientdoElement.find('#bar').css('backgroundColor','blue')endexpect(find('#bar',visible: false).native.css_value('background-color')).toeq('rgba(0, 0, 255, 1)')endit"with a name and value: returns self"doexpect_on_clientdobar=Element.find('#bar')bar.css("background","green") == barend.tobe_truthyendit"with a set of names and values: should set the properties"doon_clientdohash=Element.find("#hash")hash.css(:width=>"100px",:height=>"200px")endexpect(find('#hash',visible: false).native.css_value('width')).toeq('100px')expect(find('#hash',visible: false).native.css_value('height')).toeq('200px')endit"with a set of names and values: should return self"doexpect_on_clientdohash=Element.find("#hash")hash.css(:border=>"1px solid #000") == hashend.tobe_truthyendit"animation should accept a block as a callback"doon_clientdostart_time=Time.nowfoo=find('#animate-foo')foo.animate:width=>"200px"do@animated.resolve!Time.now - start_timeendendexpect{@animated=Promise.new}.promises.tobe >= 0.4endend
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
right now we say:
evaluate_ruby
should becomeon_client
, shorter and clearer.Given this should
expect_evaluate_ruby
becomeexpect_on_client
andexpect_promise
stays as isor
expect { ... }.on_client
andexpect { ... }.promises
??some examples:
or
The text was updated successfully, but these errors were encountered: