From d4335d56648a1345414822ed1a3ab84ad9c03653 Mon Sep 17 00:00:00 2001 From: Brian Cardarella Date: Sat, 9 Dec 2023 11:31:04 -0500 Subject: [PATCH] HTML is the correct format --- guides/introduction/installation.md | 2 +- lib/live_view_native/platforms.ex | 4 ++-- lib/live_view_native/platforms/{web.ex => html.ex} | 4 ++-- test/live_view_native/components_test.exs | 8 ++++---- test/live_view_native/live_view_test.exs | 12 ++++++------ test/live_view_native_test.exs | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) rename lib/live_view_native/platforms/{web.ex => html.ex} (76%) diff --git a/guides/introduction/installation.md b/guides/introduction/installation.md index 7c285665..33d1925a 100644 --- a/guides/introduction/installation.md +++ b/guides/introduction/installation.md @@ -312,7 +312,7 @@ for your app. iex(1)> LiveViewNative.platforms() ``` -Confirm that each platform listed (excluding `web`) has a platform-specific client app (i.e. Xcode, +Confirm that each platform listed (excluding `html`) has a platform-specific client app (i.e. Xcode, Android Studio, etc.) for connecting to your LiveView Native backend. If you used `mix lvn.install` to enable LiveView Native, these project files will be placed in the `native/` directory of your app. diff --git a/lib/live_view_native/platforms.ex b/lib/live_view_native/platforms.ex index e10263c5..807af8c4 100644 --- a/lib/live_view_native/platforms.ex +++ b/lib/live_view_native/platforms.ex @@ -5,7 +5,7 @@ defmodule LiveViewNative.Platforms do String.t() => %LiveViewNativePlatform.Env{} } - @default_platforms [LiveViewNative.Platforms.Web] + @default_platforms [LiveViewNative.Platforms.HTML] @env_platforms :live_view_native |> Application.compile_env(:plugins, []) @@ -24,7 +24,7 @@ defmodule LiveViewNative.Platforms do Provides configuration constants about all platforms supported by an application that uses LiveView Native. This function is a dependency of various LiveView Native systems, such as `LiveViewNative.LiveSession` - which is responsible for determining which platform (web, iOS, etc.) a + which is responsible for determining which platform (HTML, SwiftUI, etc.) a session originates from. """ def env_platforms do diff --git a/lib/live_view_native/platforms/web.ex b/lib/live_view_native/platforms/html.ex similarity index 76% rename from lib/live_view_native/platforms/web.ex rename to lib/live_view_native/platforms/html.ex index 0910588d..4ee21a4c 100644 --- a/lib/live_view_native/platforms/web.ex +++ b/lib/live_view_native/platforms/html.ex @@ -1,4 +1,4 @@ -defmodule LiveViewNative.Platforms.Web do +defmodule LiveViewNative.Platforms.HTML do @moduledoc false defstruct [] @@ -8,7 +8,7 @@ defmodule LiveViewNative.Platforms.Web do LiveViewNativePlatform.Env.define(:html, tag_handler: Phoenix.LiveView.HTMLEngine, template_extension: ".html.heex", - template_namespace: LiveViewNativeWeb, + template_namespace: LiveViewNative.HTML, otp_app: :live_view_native ) end diff --git a/test/live_view_native/components_test.exs b/test/live_view_native/components_test.exs index 3fd134a2..b271cab6 100644 --- a/test/live_view_native/components_test.exs +++ b/test/live_view_native/components_test.exs @@ -6,11 +6,11 @@ defmodule LiveViewNative.ComponentsTest do import Meeseeks.CSS test "test_component/1 renders as expected" do - web_context = LiveViewNativePlatform.Kit.compile(%LiveViewNative.Platforms.Web{}) + html_context = LiveViewNativePlatform.Kit.compile(%LiveViewNative.Platforms.HTML{}) test_context = LiveViewNativePlatform.Kit.compile(%LiveViewNative.TestPlatform{}) - web_result = - render_component(&TestComponents.test_component/1, format: :web, native: web_context) + html_result = + render_component(&TestComponents.test_component/1, format: :html, native: html_context) |> Meeseeks.parse(:html) test_result = @@ -36,7 +36,7 @@ defmodule LiveViewNative.ComponentsTest do component_with_slot_result_slot = Meeseeks.one(test_result, css("#component-with-slot-test #slot-test")) - html_element_result = Meeseeks.one(web_result, css("#html-element-test")) + html_element_result = Meeseeks.one(html_result, css("#html-element-test")) assert Meeseeks.text(local_component_result) == "Local Component Rendered" assert Meeseeks.text(remote_component_result) == "Remote Component Rendered" diff --git a/test/live_view_native/live_view_test.exs b/test/live_view_native/live_view_test.exs index d85c7954..3eee8f67 100644 --- a/test/live_view_native/live_view_test.exs +++ b/test/live_view_native/live_view_test.exs @@ -11,12 +11,12 @@ defmodule LiveViewNative.LiveViewTest do end test "calling render_native/1 renders the correct platform for `assigns`" do - web_context = LiveViewNativePlatform.Kit.compile(%LiveViewNative.Platforms.Web{}) + html_context = LiveViewNativePlatform.Kit.compile(%LiveViewNative.Platforms.HTML{}) test_context = LiveViewNativePlatform.Kit.compile(%LiveViewNative.TestPlatform{}) - web_result = TestLiveView.render(%{format: :html, native: web_context}) + html_result = TestLiveView.render(%{format: :html, native: html_context}) test_result = TestLiveView.render(%{format: :lvntest, native: test_context}) - assert web_result.static == [ + assert html_result.static == [ "
\n This is an HTML template\n \n
" ] @@ -26,12 +26,12 @@ defmodule LiveViewNative.LiveViewTest do end test "calling render/1 renders platform-specific templates inline" do - web_context = LiveViewNativePlatform.Kit.compile(%LiveViewNative.Platforms.Web{}) + html_context = LiveViewNativePlatform.Kit.compile(%LiveViewNative.Platforms.HTML{}) test_context = LiveViewNativePlatform.Kit.compile(%LiveViewNative.TestPlatform{}) - web_result = TestLiveViewInline.render(%{format: :html, native: web_context}) + html_result = TestLiveViewInline.render(%{format: :html, native: html_context}) test_result = TestLiveViewInline.render(%{format: :lvntest, native: test_context}) - assert web_result.static == ["
Hello from the web
"] + assert html_result.static == ["
Hello from the web
"] assert test_result.static == [ "