Skip to content

Commit

Permalink
Cleaning up some unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-hughes committed Oct 24, 2023
1 parent 369d792 commit 676c980
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { propTypes } from 'react-bootstrap/esm/Image';
import { Editor, Element } from 'slate';
import { ReactEditor, useSlate } from 'slate-react';
import {
Expand All @@ -15,7 +14,6 @@ import { BlockSettings } from 'components/editing/toolbar/editorToolbar/blocks/B
import { BlockToggle } from 'components/editing/toolbar/editorToolbar/blocks/BlockToggle';
import { TextDirection } from 'data/content/model/elements/types';
import { useDefaultTextDirection } from 'utils/useDefaultTextDirection';
import { useStateFromLocalStorage } from 'utils/useStateFromLocalStorage';
import { EditorSettingsMenu } from './EditorSettingsMenu';

interface Props {
Expand Down
2 changes: 1 addition & 1 deletion test/oli/editing/page_editor_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ defmodule Oli.EditingTest do
} do
html = PageEditor.render_page_html(project.slug, revision.content, author)

assert html == [["<p>", [[[[], "Here" | "&#39;"] | "s some test content"]], "</p>\n"]]
assert html == ["<div dir=\"ltr\">",[["<p>", [[[[], "Here" | "&#39;"] | "s some test content"]], "</p>\n"]],"</div>"]
end

test "construct_parent_references/1", %{
Expand Down
6 changes: 3 additions & 3 deletions test/oli/rendering/alternatives/html_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,19 @@ defmodule Oli.Rendering.Alternatives.HtmlTest do

# renders R alternative
assert rendered_html_string =~
~s|<div class="alternative alternative-DhY8ERStw7vXActR5U5BqR"><p>R</p>|
~s|<div class="alternative alternative-DhY8ERStw7vXActR5U5BqR"><div dir="ltr"><p>R</p>|

# renders activity embedded in R alternative
assert rendered_html_string =~
~s|<oli-multiple-choice-delivery phx-update="ignore" class="activity-container" state="{ "active": true }" model="{ "choices": [ "A", "B", "C", "D" ], "feedback": [ "A", "B", "C", "D" ], "stem": ""}" mode="author_preview"|

# renders Excel alternative
assert rendered_html_string =~
~s|<div class="alternative alternative-kQqFWsHyXeMenEDzT9rymP"><p>Excel</p>\n</div>|
~s|<div class="alternative alternative-kQqFWsHyXeMenEDzT9rymP"><div dir=\"ltr\"><p>Excel</p>\n</div>|

# renders Python alternative
assert rendered_html_string =~
~s|<div class="alternative alternative-bdaqYkKs8RFE4LWLmPCLnf"><p>Python</p>\n</div>|
~s|<div class="alternative alternative-bdaqYkKs8RFE4LWLmPCLnf"><div dir=\"ltr\"><p>Python</p>\n</div>|
end
end
end
4 changes: 2 additions & 2 deletions test/oli/rendering/page/html_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ defmodule Oli.Content.Page.HtmlTest do
rendered_html_string =
Phoenix.HTML.raw(rendered_html) |> Phoenix.HTML.safe_to_string()

assert rendered_html_string == "<p>some specific content</p>\n"
assert rendered_html_string == "<div dir=\"ltr\"><p>some specific content</p>\n</div>"
end)
end

Expand All @@ -168,7 +168,7 @@ defmodule Oli.Content.Page.HtmlTest do
rendered_html_string =
Phoenix.HTML.raw(rendered_html) |> Phoenix.HTML.safe_to_string()

assert rendered_html_string == "<p>some specific content</p>\n"
assert rendered_html_string == "<div dir=\"ltr\"><p>some specific content</p>\n</div>"
end)
end

Expand Down
2 changes: 1 addition & 1 deletion test/oli/rendering/survey/html_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ defmodule Oli.Content.Survey.HtmlTest do
~s|<div id="1855946510" class="survey"><div class="survey-label">Survey</div><div class="survey-content">|

assert rendered_html_string =~
~s|<p>Please complete the following survey:</p>\n<oli-multiple-choice-delivery phx-update="ignore" class="activity-container" state="{ "active": true }" model="{ "choices": [ "A", "B", "C", "D" ], "feedback": [ "A", "B", "C", "D" ], "stem": ""}" mode="delivery"|
~s|<p>Please complete the following survey:</p>\n</div><oli-multiple-choice-delivery phx-update="ignore" class="activity-container" state="{ "active": true }" model="{ "choices": [ "A", "B", "C", "D" ], "feedback": [ "A", "B", "C", "D" ], "stem": ""}" mode="delivery"|

assert rendered_html_string =~
~s|</oli-multiple-choice-delivery>|
Expand Down
12 changes: 6 additions & 6 deletions test/oli_web/live/ingest_live_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ defmodule OliWeb.IngestLiveTest do

assert has_element?(
view,
"table > tbody > tr > td",
"div > table > tbody > tr > td",
"Could not locate required file _media-manifest.json in archive"
)
end,
1_000
5_000
)
end

Expand Down Expand Up @@ -122,7 +122,7 @@ defmodule OliWeb.IngestLiveTest do
"Could not locate required file _hierarchy.json in archive"
)
end,
1_000
5_000
)
end

Expand Down Expand Up @@ -161,7 +161,7 @@ defmodule OliWeb.IngestLiveTest do
"Could not locate required file _project.json in archive"
)
end,
1_000
5_000
)
end

Expand Down Expand Up @@ -215,7 +215,7 @@ defmodule OliWeb.IngestLiveTest do
"Could not locate required file _project.json in archive"
)
end,
1_000
5_000
)
end

Expand Down Expand Up @@ -263,7 +263,7 @@ defmodule OliWeb.IngestLiveTest do
"None exist"
)
end,
1_500
5_500
)
end

Expand Down

0 comments on commit 676c980

Please sign in to comment.