mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
fix: fix pictogram categories always hidden
This commit is contained in:
parent
18f0b6e2a7
commit
d9378a484d
2 changed files with 12 additions and 3 deletions
|
@ -808,9 +808,10 @@ Fields.IconUrl = class extends Fields.BlurInput {
|
|||
}
|
||||
|
||||
addCategory(items, name) {
|
||||
const hidden = name ? '' : ' hidden'
|
||||
const [parent, { grid }] = Utils.loadTemplateWithRefs(`
|
||||
<div class="umap-pictogram-category">
|
||||
<h6 hidden=${!name}>${name}</h6>
|
||||
<h6${hidden}>${name}</h6>
|
||||
<div class="umap-pictogram-grid" data-ref=grid></div>
|
||||
</div>
|
||||
`)
|
||||
|
|
|
@ -32,9 +32,15 @@ FIXTURES = Path(__file__).parent.parent / "fixtures"
|
|||
@pytest.fixture
|
||||
def pictos():
|
||||
path = FIXTURES / "star.svg"
|
||||
Pictogram(name="star", pictogram=ContentFile(path.read_text(), path.name)).save()
|
||||
Pictogram(
|
||||
name="star", pictogram=ContentFile(path.read_text(), path.name), category="cat1"
|
||||
).save()
|
||||
path = FIXTURES / "circle.svg"
|
||||
Pictogram(name="circle", pictogram=ContentFile(path.read_text(), path.name)).save()
|
||||
Pictogram(
|
||||
name="circle",
|
||||
pictogram=ContentFile(path.read_text(), path.name),
|
||||
category="cat2",
|
||||
).save()
|
||||
|
||||
|
||||
def test_can_change_picto_at_map_level(openmap, live_server, page, pictos):
|
||||
|
@ -57,6 +63,8 @@ def test_can_change_picto_at_map_level(openmap, live_server, page, pictos):
|
|||
define.click()
|
||||
# No picto defined yet, so recent should not be visible
|
||||
expect(page.get_by_text("Recent")).to_be_hidden()
|
||||
expect(page.get_by_text("cat1")).to_be_visible()
|
||||
expect(page.get_by_text("cat2")).to_be_visible()
|
||||
symbols = page.locator(".umap-pictogram-body .umap-pictogram-choice")
|
||||
expect(symbols).to_have_count(2)
|
||||
search = page.locator(".umap-pictogram-body input")
|
||||
|
|
Loading…
Reference in a new issue