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"): tdiv(class="title"):
p(): text "New Thread" p(): text "New Thread"
tdiv(class="content"): 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", placeholder="Type the title here",
oninput=(e: Event, n: VNode) => onSubjectChange(e, n, state)) oninput=(e: Event, n: VNode) => onSubjectChange(e, n, state))
if state.error.isSome(): if state.error.isSome():
@ -58,9 +58,10 @@ when defined(js):
renderContent(state.replyBox, none[Thread](), none[Post]()) renderContent(state.replyBox, none[Thread](), none[Post]())
tdiv(class="footer"): tdiv(class="footer"):
button(class=class( button(id="create-thread-btn",
{"loading": state.loading}, class=class(
"btn btn-primary" {"loading": state.loading},
"btn btn-primary"
), ),
onClick=(ev: Event, n: VNode) => onClick=(ev: Event, n: VNode) =>
(onCreateClick(ev, n, state))): (onCreateClick(ev, n, state))):

View file

@ -220,8 +220,11 @@ when defined(js):
): VNode = ): VNode =
let postCopy = post # TODO: Another workaround here, closure capture :( let postCopy = post # TODO: Another workaround here, closure capture :(
let originalPost = thread.author == post.author
result = buildHtml(): 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"): tdiv(class="post-icon"):
render(post.author, "post-avatar") render(post.author, "post-avatar")
tdiv(class="post-main"): tdiv(class="post-main"):
@ -326,7 +329,7 @@ when defined(js):
let list = state.list.get() let list = state.list.get()
result = buildHtml(): result = buildHtml():
section(class="container grid-xl"): section(class="container grid-xl"):
tdiv(class="title"): tdiv(id="thread-title", class="title"):
p(): text list.thread.topic p(): text list.thread.topic
if list.thread.isLocked: if list.thread.isLocked:
italic(class="fas fa-lock fa-xs", italic(class="fas fa-lock fa-xs",

View file

@ -114,7 +114,8 @@ when defined(js):
elif state.rendering.isSome(): elif state.rendering.isSome():
verbatim(state.rendering.get()) verbatim(state.rendering.get())
else: 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: Event, n: VNode) =>
onChange(e, n, state), onChange(e, n, state),
value=state.text) value=state.text)

View file

@ -78,7 +78,7 @@ when defined(js):
button(class="btn btn-link"): text "Categories" button(class="btn btn-link"): text "Categories"
section(class="navbar-section"): section(class="navbar-section"):
if currentUser.isSome(): if currentUser.isSome():
a(href=makeUri("/newthread"), onClick=anchorCB): a(id="new-thread-btn", href=makeUri("/newthread"), onClick=anchorCB):
button(class="btn btn-secondary"): button(class="btn btn-secondary"):
italic(class="fas fa-plus") italic(class="fas fa-plus")
text " New Thread" text " New Thread"