Skip to content

Commit

Permalink
Fix relative path to global loading indicator assets (#7181)
Browse files Browse the repository at this point in the history
* Fix relative path to global loading indicator assets

* Add tests
  • Loading branch information
philippjfr authored Aug 24, 2024
1 parent 2d42e64 commit 6c045a3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion panel/io/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ def css_raw(self):
# Add loading spinner
if config.global_loading_spinner:
loading_base = (DIST_DIR / "css" / "loading.css").read_text(encoding='utf-8').replace(
'../assets', self.dist_dir
'../assets', self.dist_dir + 'assets'
)
raw.extend([loading_base, loading_css(
config.loading_spinner, config.loading_color, config.loading_max_height
Expand Down
13 changes: 13 additions & 0 deletions panel/tests/io/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,16 @@ def test_resolve_stylesheet_long_css():
}
"""
assert resolve_stylesheet(cls, stylesheet, "_stylesheets")==stylesheet

def test_resources_global_loading_indicator_server():
resources = Resources(mode='server')
with config.set(global_loading_spinner=True):
assert len(resources.css_raw) == 2
assert resources.css_raw[0].count('static/extensions/panel/assets') == 5

def test_resources_global_loading_indicator_cdn():
resources = Resources(mode='cdn')
with config.set(global_loading_spinner=True):
assert len(resources.css_raw) == 2
assert resources.css_raw[0].count('https://cdn.holoviz.org/panel/') == 5
assert resources.css_raw[0].count('/dist/assets/') == 5

0 comments on commit 6c045a3

Please sign in to comment.