Add untracked files.
This commit is contained in:
parent
c37d8e4295
commit
630df6fab3
11
lib/jol_web/components/blog.ex
Normal file
11
lib/jol_web/components/blog.ex
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
defmodule JOLWeb.Components.Blog do
|
||||||
|
@moduledoc """
|
||||||
|
This module holds various ways of rendering a `JOL.Blog.Post`.
|
||||||
|
|
||||||
|
See the `blog` directory for the available templates.`
|
||||||
|
"""
|
||||||
|
|
||||||
|
use JOLWeb, :html
|
||||||
|
|
||||||
|
embed_templates "blog/*"
|
||||||
|
end
|
3
lib/jol_web/components/blog/post_summary.html.heex
Normal file
3
lib/jol_web/components/blog/post_summary.html.heex
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="post_summary">
|
||||||
|
<h3><%= @post.title %></h3>
|
||||||
|
</div>
|
3
lib/jol_web/components/blog/summary.html.heex
Normal file
3
lib/jol_web/components/blog/summary.html.heex
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="post_summary">
|
||||||
|
<h3 class="title"><%= @blog.title %></h3>
|
||||||
|
</div>
|
33
test/lib/blog/post_test.ex
Normal file
33
test/lib/blog/post_test.ex
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
defmodule JOL.Blog.PostTest do
|
||||||
|
use ExUnit.Case, async: true
|
||||||
|
alias JOL.Blog.Post
|
||||||
|
|
||||||
|
setup do
|
||||||
|
attrs = %{
|
||||||
|
title: "Test Post",
|
||||||
|
tags: ["testing", "post"],
|
||||||
|
date: ~D[1999-09-09],
|
||||||
|
slug: "test-post"
|
||||||
|
}
|
||||||
|
|
||||||
|
{:ok, attrs: attrs}
|
||||||
|
end
|
||||||
|
|
||||||
|
test "extracts ledes from <!-- more --> delimiters", %{attrs: attrs} do
|
||||||
|
body = """
|
||||||
|
lede goes here
|
||||||
|
<!-- more -->
|
||||||
|
not this though.
|
||||||
|
"""
|
||||||
|
|
||||||
|
post = Post.build("filename", attrs, body)
|
||||||
|
assert post.lede == "lede goes here"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "extract ledes without delimiters", %{attrs: attrs} do
|
||||||
|
body = Enum.map_join(1..100, &("Word#{&1} "))
|
||||||
|
post = Post.build("filename", attrs, body)
|
||||||
|
assert String.split(post.lede) |> Enum.count == 50
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
7
test/lib/blog_test.ex
Normal file
7
test/lib/blog_test.ex
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
defmodule JOL.BlogTest do
|
||||||
|
use ExUnit.Case, async: true
|
||||||
|
|
||||||
|
setup do
|
||||||
|
{:ok, %{}}
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue