These are chat archives for mojotech/pioneer

26th
Aug 2014
Josh
@joshtombs
Aug 26 2014 13:47 UTC
hey @thejameskyle
I'm trying to use your code for the static methods instead of writing them all repetitively
staticMethods = ["click", "fill", "hover", "doubleClick", "read", "isPresent", "isVisible", "getAttribute", "getValue", "getText", "getInnerHTML", "getOuterHtml", "hasClass"]
for staticMethod in staticMethods
  @[staticMethod] = =>
    args = arguments
    @find({root: "html"}).then (w) =>
      w[staticMethod].apply(this, args)
its throwing an error for each one though saying that they are all undefined
Josh
@joshtombs
Aug 26 2014 13:55 UTC
i think i found bug
staticMethod is defined as "hasClass" at the end of he loop
so it tries calling hasClass in every situation i think, because it keeps logging the hasClass method
Sam Saccone
@samccone
Aug 26 2014 13:55 UTC
weird…...
Josh
@joshtombs
Aug 26 2014 13:57 UTC
function () {
      var args;
      args = arguments;
      return Widget.find({
        root: "html"
      }).then(function(w) {
        return w[staticMethod].apply(Widget, args);
      });
   }
thats what happens when i log @W.click.toString()
Sam Saccone
@samccone
Aug 26 2014 13:58 UTC
hmmm
Josh
@joshtombs
Aug 26 2014 13:58 UTC
and static method is defined as hasClass
is there a way i can pass that value down?
Sam Saccone
@samccone
Aug 26 2014 14:00 UTC
yes
Jamie
@jamiebuilds
Aug 26 2014 14:00 UTC
Are those functions supposed to be -> instead of =>
Josh
@joshtombs
Aug 26 2014 14:12 UTC
the first one has to be => because we need to bind the context of this in order to call `@find`
the second one would have had to be => because i wanted to call .apply(this)
Jamie
@jamiebuilds
Aug 26 2014 14:14 UTC
I just don’t get how this works at all:
@[staticMethod] = =>
Josh
@joshtombs
Aug 26 2014 14:14 UTC
the second one doesnt have to be anymore because i changed the context of apply from this to w
for staticMethod in staticMethods
    m = (args...) =>
      @find({root: "html"}).then (w) ->
        w[args[0]].apply(w, args.slice(1))

    @[staticMethod] = _.partial(m, staticMethod)
what i have right now
okay that works :D
@samccone that one problem was because i defined getOuterHTML as getOuterHtml
Sam Saccone
@samccone
Aug 26 2014 14:18 UTC
makes sense
:)
Josh
@joshtombs
Aug 26 2014 14:19 UTC
yup +1 @thejameskyle for coming up with that
Jamie
@jamiebuilds
Aug 26 2014 14:36 UTC
@joshtombs it comes right from this: http://backbonejs.org/docs/backbone.html#section-121
Sam Saccone
@samccone
Aug 26 2014 14:36 UTC
heh
good ol backbone
Sam Saccone
@samccone
Aug 26 2014 15:06 UTC
@thejameskyle all these static methods are going to make your code real nice
Josh
@joshtombs
Aug 26 2014 17:56 UTC
@samccone do we include everything since release 0.8.0 or everything since 0.8.2 in the release notes
Sam Saccone
@samccone
Aug 26 2014 17:57 UTC
0.8.2
Josh
@joshtombs
Aug 26 2014 17:57 UTC
okay cool
Sam Saccone
@samccone
Aug 26 2014 17:59 UTC
sorry just plugging away at this app here
Josh
@joshtombs
Aug 26 2014 17:59 UTC
all good :dog:
:dawg:
Josh
@joshtombs
Aug 26 2014 18:33 UTC
@samccone do you want a static sendKeys ?
Sam Saccone
@samccone
Aug 26 2014 18:37 UTC
sure
Josh
@joshtombs
Aug 26 2014 19:28 UTC
@samccone i think we ready for 0.9.0 :D
Sam Saccone
@samccone
Aug 26 2014 19:28 UTC
ha
Sam Saccone
@samccone
Aug 26 2014 19:59 UTC
boom
@thejameskyle @joshtombs all out
v0.9.0
Josh
@joshtombs
Aug 26 2014 19:59 UTC
woohoo