This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-29
Channels
- # aws (6)
- # beginners (33)
- # bitcoin (2)
- # boot (22)
- # carry (2)
- # cider (5)
- # clara (21)
- # cljs-dev (115)
- # cljsrn (40)
- # clojure (161)
- # clojure-dev (73)
- # clojure-italy (38)
- # clojure-russia (88)
- # clojure-spec (123)
- # clojure-uk (58)
- # clojurescript (88)
- # core-async (26)
- # cursive (5)
- # datascript (18)
- # datomic (26)
- # hoplon (50)
- # java (2)
- # jobs (1)
- # leiningen (10)
- # lumo (1)
- # off-topic (18)
- # om (9)
- # onyx (26)
- # parinfer (13)
- # pedestal (41)
- # quil (1)
- # re-frame (27)
- # reagent (21)
- # ring-swagger (11)
- # slack-help (3)
- # spacemacs (8)
- # specter (5)
- # sql (42)
- # timbre (1)
- # uncomplicate (7)
- # untangled (3)
- # videos (1)
- # yada (26)
ugh, i think i need a hand with google closure events
in hoplon i see stuff like this
(defmethod do! :select
[elem _ _]
(events/dispatchEvent elem goog.events.EventType.SELECT))
i'm trying to emulate that
i wrote a function like this
(defn input-val!
"Sets the val of el to the given v, but also triggers input, which is often necessary for tests."
[el v]
(val! el v)
(goog.events/dispatchEvent el goog.events.EventType.INPUT))
which is just a port of a jquery based function i had before
i wrote a simple test
(deftest ??input-val!
(let [c (j/cell nil)
el (h/input :input #(reset! c @%))]
(input-val! el "foo")
(is (= "foo" @c))))
the result i'm seeing is this
Assertion failed: Can not use goog.events.dispatchEvent with non-goog.events.Listenable instance.
so, what is hoplon doing that i'm not doing?
this SO post makes me think that hoplon wouldn't be working either... https://stackoverflow.com/questions/23948201/dispatch-event-on-the-angular-element-in-jasmine-test-is-not-working
this doesn't work
(deftest ??hoplon-select
(h/input :select true))
@thedavidmeister I think we can resolve much of this, I’m not sure where the on!
multi-method went for goog
i think there's two things going on
1. maybe we can improve hoplon.goog
2. i feel like i'm shaving yaks when what i really want is for SVG to not break in hoplon.jquery
@thedavidmeister yeah, we can fix both those things hahaha
so for svg support, we should replace the internal :svg/*
implementation
it shouldnt work the same as the regular attributes
yeah, it should just do the same thing as -set-attributes!
in hoplon.core i think
hoplon core is what it does currently
well, the old one
it just needs to be (.setAttribute elem k v)
which i think it was in core at some point
but i think it has changed to .attr
from jquery since jquery/goog split
yeah still is, we can just remove the jquery one and it will use the vanillajs version
ah cool
ie remove https://github.com/hoplon/hoplon/blob/master/src/hoplon/jquery.cljs#L52-L54
i can put a pr up for that
yeah since svg is a known broken thing with jquery it really shouldnt have a method for that
my bad, probably an artifact from when I split jquery out from core
the flipside is that there should be many more tests running to catch stuff like this
@flyboarder ^^ tests passing on this
I vaguely remember a longish discussion from awhile back on being able to access attributes as keywords like that. Did I dream that? Might have been on discourse or an issue but I haven't been able to find it
@jjttjj It would simply need replacing of the current IFn with a protocol that does type dispatch, or we can localize the type check to a cond
@flyboarder cool yeah I have no opinion on it one way or the other, seems cool to me, just had some deja vu that it was discussed before (and I don't remember the outcome of the discussion)
yeah I think it’s worth a PR 😛
do I have time for it tho
btw awesome work on all the spec stuff, I'm just getting up to speed with clojure spec now finally and loving it
no prob :thumbsup: it was worth it, I basically took my app and wrote specs until my existing app passed
and now there is some ground work for whatever spec final ends up being
but I think the core file is getting long, probably due for a cleanup