Skip to content

Commit

Permalink
Merge pull request #81 from liveview-native/bc-rename-web-to-html
Browse files Browse the repository at this point in the history
HTML is the correct format
  • Loading branch information
bcardarella authored Dec 9, 2023
2 parents b6c55db + d4335d5 commit ba6993d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion guides/introduction/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions lib/live_view_native/platforms.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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, [])
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LiveViewNative.Platforms.Web do
defmodule LiveViewNative.Platforms.HTML do
@moduledoc false

defstruct []
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions test/live_view_native/components_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions test/live_view_native/live_view_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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 == [
"<div>\n <span>This is an HTML template</span>\n <input>\n</div>"
]

Expand All @@ -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 == ["<div>Hello from the web</div>"]
assert html_result.static == ["<div>Hello from the web</div>"]

assert test_result.static == [
"<compiled-lvn-stylesheet",
Expand Down
4 changes: 2 additions & 2 deletions test/live_view_native_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ defmodule LiveViewNativeTest do

assert platform_struct
assert platform_struct.platform_id == :html
assert platform_struct.platform_config == %LiveViewNative.Platforms.Web{}
assert platform_struct.platform_config == %LiveViewNative.Platforms.HTML{}
end
end

Expand All @@ -37,7 +37,7 @@ defmodule LiveViewNativeTest do

assert platform_struct
assert platform_struct.platform_id == :html
assert platform_struct.platform_config == %LiveViewNative.Platforms.Web{}
assert platform_struct.platform_config == %LiveViewNative.Platforms.HTML{}
end

test "when platform_id is invalid" do
Expand Down

0 comments on commit ba6993d

Please sign in to comment.