node-horseman icon indicating copy to clipboard operation
node-horseman copied to clipboard

Add .if_exists()/.if_visible() (implements #266)

Open aexaey opened this issue 8 years ago • 6 comments

aexaey avatar Feb 28 '17 04:02 aexaey

I'm not sure how I feel about these functions. They feel unnecessary to me.

If other people want them I might pull them in. Do you have an opinion @johntitus?

Also, the underscores in the name irk me, the do not match any of the other function names.

awlayton avatar Mar 07 '17 19:03 awlayton

Regarding underscores - would this sort of syntax be more palatable?

.visible('#foo')
.if(function() {
        ...

i.e. add new if action that does the same as then, but conditionally.

aexaey avatar Mar 07 '17 20:03 aexaey

I would have just made them .ifExists and .ifVisible

awlayton avatar Mar 07 '17 20:03 awlayton

Oh, I see. Cool. I've changed PR to use headlessCamelCase.

aexaey avatar Mar 07 '17 20:03 aexaey

Seems useful but I too hesitate to go too far down this sort of rabbit hole. I lean towards accepting this PR (and thanks for making it @aexaey) if tests are added.

johntitus avatar Mar 07 '17 22:03 johntitus

Thanks @johntitus , I've added tests and bare-bones descriptions to Readme.md. Let me know if you'd like this PR squashed into a single commit.

aexaey avatar Mar 08 '17 00:03 aexaey