Hi everyone,
I am trying to write some ClojureScript to use with CodeMirror, like a new
keymap. For testing, I have PhantomJS installed. I'm trying to programmatically
create a test page with a CodeMirror instance on it.
It would be good if all of my test cases can re-use the same CodeMirror
instance.
So my thought is at the beginning of my test cljs file, I'll create the page
(dommy/append! js/document.body ...
Is this the right starting point? I'd like to get a textarea with some known
id, then do the equivalent of calling CodeMirror.fromTextArea with it plus a
property map that assigns the keyMap to mine. So the equivalent of javascript:
var textArea = document.getElementById("knownId");
var editor = CodeMirror.fromTextArea(textArea,
{
keyMap: "myMap"
});
textArea.myCodeMirrorInstance = editor;
What would the above look like in ClojureScript with dommy?
And I'll save the CM instance ...
(def cm-instance (-> "#knownId" sel1 .-myCodeMirrorInstance))
And use `cm-instance` in my tests.
I had an earlier setup (with lein) that seemed to work, but then I realized the
unit tests were grabbing the actual index.html for my project. Which meant I
could just have the plain javascript above as is in index.html, plus the cljs
(-> "#knownId" sel1 .-myCodeMirrorInstance) and I was all set.
I think it's better that the unit tests use some other virtual page it creates.
Now I'm trying to use boot and I'm not even sure how to get it working either
way (either using index.html or having a separate dommy-created page
headlessly).
Any help would be appreciated!
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.