Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed Mar 19, 2024
2 parents e1be6f0 + 90615d8 commit 024a8a4
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 13 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ on:
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
continue-on-error: ${{ matrix.version == 'nightly'}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.6'
- '1.7'
- '1.10'
- '1'
- 'nightly'
os:
- ubuntu-latest
- macOS-latest
Expand All @@ -33,7 +34,7 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: '1.7'
version: '1'
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Stipple"
uuid = "4acbeb90-81a0-11ea-1966-bdaff8155998"
authors = ["Adrian <[email protected]>"]
version = "0.28.4"
version = "0.28.5"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
4 changes: 2 additions & 2 deletions src/Pages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ function Page( route::Union{Route,String};
Core.eval(context, model)
elseif isa(model, Module)
context = model
@eval(context, Stipple.ReactiveTools.@init(debounce = $debounce, transport = $transport, core_theme = $core_theme))
() -> @eval(context, Stipple.ReactiveTools.@init(debounce = $debounce, transport = $transport, core_theme = $core_theme))
elseif model isa DataType
@eval(context, Stipple.ReactiveTools.@init($model; debounce = $debounce, transport = $transport, core_theme = $core_theme))
() -> @eval(context, Stipple.ReactiveTools.@init($model; debounce = $debounce, transport = $transport, core_theme = $core_theme))
else
model
end
Expand Down
18 changes: 11 additions & 7 deletions src/ReactiveTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,14 @@ function DEFAULT_LAYOUT(; title::String = "Genie App",
<% end %>
<style>
._genie_logo {
background:url('https://genieframework.com/logos/genie/logo-simple-with-padding.svg') no-repeat;background-size:40px;
padding-top:22px;padding-right:10px;color:transparent;font-size:9pt;
background:url('https://genieframework.com/logos/genie/logo-simple-with-padding.svg') no-repeat;
background-size:40px;
padding-top:22px;
padding-right:10px;
color:transparent !important;
font-size:9pt;
}
._genie .row .col-12 { width:50%;margin:auto; }
._genie .row .col-12 { width:50%; margin:auto; }
</style>
$(join(head_content, "\n "))
</head>
Expand Down Expand Up @@ -339,12 +343,12 @@ macro debounce(fieldname, ms)
end

"""
@clear_debounce
@clear_debounce
@clear_debounce fieldname
@clear_debounce App
@clear_debounce App fieldname
Clear field-specific debounce time, for setting see `@debounce`.
Expand Down Expand Up @@ -1145,7 +1149,7 @@ Registers a new page with source in `view` to be rendered at the route `url`.
```julia
@page("/", "view.html")
@page("/", ui; model = MyApp) # for specifying an explicit app
@page("/", ui; model = MyApp) # for specifying an explicit app
```
"""
macro page(expressions...)
Expand Down
50 changes: 50 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,56 @@ end
@test model.s3[] == "20"
end

module App1

using Stipple, Stipple.ReactiveTools
@app begin
@in i1 = 101
end

@app MyApp begin
@in i1 = 101
end

end

module App2
using Stipple, Stipple.ReactiveTools

@app begin
@in i2 = 102
end

@app MyApp begin
@in i2 = 102
end

end

@testset "Multipage Reactive API (implicit)" begin
@eval p1 = @page("/app1", "hello", model = App1)
@eval p2 = @page("/app2", "world", model = App2)
channel1a = get_channel(String(p1.route.action().body))
channel1b = get_channel(String(p1.route.action().body))
channel2a = get_channel(String(p2.route.action().body))
channel2b = get_channel(String(p2.route.action().body))

# channels have to be different
@test channel1a != channel1b != channel2a != channel2b
end

@testset "Multipage Reactive API (explicit)" begin
@eval p1 = @page("/app1", "hello", model = App1.MyApp)
@eval p2 = @page("/app2", "world", model = App2.MyApp)
channel1a = get_channel(String(p1.route.action().body))
channel1b = get_channel(String(p1.route.action().body))
channel2a = get_channel(String(p2.route.action().body))
channel2b = get_channel(String(p2.route.action().body))

# channels have to be different
@test channel1a != channel1b != channel2a != channel2b
end

using DataFrames
@testset "Extensions" begin
d = Dict(:a => [1, 2, 3], :b => ["a", "b", "c"])
Expand Down

0 comments on commit 024a8a4

Please sign in to comment.