Add untracked files.

This commit is contained in:
Jessica Canady 2024-08-17 09:22:54 -04:00
parent c37d8e4295
commit 630df6fab3
Signed by: phoenix
SSH key fingerprint: SHA256:aaLOzOrLi+0n4eDZNQKH97PehwRt6KSE5fYJc+ZRKCQ
5 changed files with 57 additions and 0 deletions

View 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

View file

@ -0,0 +1,3 @@
<div class="post_summary">
<h3><%= @post.title %></h3>
</div>

View file

@ -0,0 +1,3 @@
<div class="post_summary">
<h3 class="title"><%= @blog.title %></h3>
</div>

View 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
View file

@ -0,0 +1,7 @@
defmodule JOL.BlogTest do
use ExUnit.Case, async: true
setup do
{:ok, %{}}
end
end