Add helpful ids and classes for testing

This commit is contained in:
Joey Yakimowich-Payne 2018-07-13 09:16:48 +09:00
commit 122e279256
4 changed files with 17 additions and 12 deletions

View file

@ -49,7 +49,7 @@ when defined(js):
tdiv(class="title"):
p(): text "New Thread"
tdiv(class="content"):
input(class="form-input", `type`="text", name="subject",
input(id="thread-title", class="form-input", `type`="text", name="subject",
placeholder="Type the title here",
oninput=(e: Event, n: VNode) => onSubjectChange(e, n, state))
if state.error.isSome():
@ -58,10 +58,11 @@ when defined(js):
renderContent(state.replyBox, none[Thread](), none[Post]())
tdiv(class="footer"):
button(class=class(
{"loading": state.loading},
"btn btn-primary"
button(id="create-thread-btn",
class=class(
{"loading": state.loading},
"btn btn-primary"
),
onClick=(ev: Event, n: VNode) =>
(onCreateClick(ev, n, state))):
text "Create thread"
text "Create thread"

View file

@ -220,8 +220,11 @@ when defined(js):
): VNode =
let postCopy = post # TODO: Another workaround here, closure capture :(
let originalPost = thread.author == post.author
result = buildHtml():
tdiv(class=class({"highlight": highlight}, "post"), id = $post.id):
tdiv(class=class({"highlight": highlight, "original-post": originalPost}, "post"),
id = $post.id):
tdiv(class="post-icon"):
render(post.author, "post-avatar")
tdiv(class="post-main"):
@ -326,7 +329,7 @@ when defined(js):
let list = state.list.get()
result = buildHtml():
section(class="container grid-xl"):
tdiv(class="title"):
tdiv(id="thread-title", class="title"):
p(): text list.thread.topic
if list.thread.isLocked:
italic(class="fas fa-lock fa-xs",
@ -368,4 +371,4 @@ when defined(js):
render(state.replyBox, list.thread, state.replyingTo, false)
render(state.deleteModal)
render(state.deleteModal)

View file

@ -114,7 +114,8 @@ when defined(js):
elif state.rendering.isSome():
verbatim(state.rendering.get())
else:
textarea(class="form-input post-text-area", rows="5",
textarea(id="reply-textarea",
class="form-input post-text-area", rows="5",
onChange=(e: Event, n: VNode) =>
onChange(e, n, state),
value=state.text)
@ -162,4 +163,4 @@ when defined(js):
button(class="btn"):
italic(class="fas fa-arrow-up")
tdiv(class="information-content"):
renderContent(state, some(thread), post)
renderContent(state, some(thread), post)

View file

@ -78,7 +78,7 @@ when defined(js):
button(class="btn btn-link"): text "Categories"
section(class="navbar-section"):
if currentUser.isSome():
a(href=makeUri("/newthread"), onClick=anchorCB):
a(id="new-thread-btn", href=makeUri("/newthread"), onClick=anchorCB):
button(class="btn btn-secondary"):
italic(class="fas fa-plus")
text " New Thread"
@ -243,4 +243,4 @@ when defined(js):
proc renderThreadList*(currentUser: Option[User]): VNode =
result = buildHtml(tdiv):
genTopButtons(currentUser)
genThreadList(currentUser)
genThreadList(currentUser)