Skip to content

Commit

Permalink
SQ -> Entity Tree: Select newly created root URL or group if selectio…
Browse files Browse the repository at this point in the history
…n was empty
  • Loading branch information
davidfstr committed Aug 27, 2024
1 parent c9a85b4 commit 28facc0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/crystal/tests/test_entitytree.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,11 @@ async def test_when_selected_entity_changes_and_top_level_entity_menu_opened_the
project = Project._last_opened_project
assert project is not None

rr = RootResource(project, '', Resource(project, 'https://neocities.org/'))
rr2 = RootResource(project, '', Resource(project, 'https://neocities.org/~distantskies/'))

root_ti = TreeItem.GetRootItem(mw.entity_tree.window)
rrn = root_ti.find_child(rr.resource.url, project.default_url_prefix)
rrn2 = root_ti.find_child(rr2.resource.url, project.default_url_prefix)

# Case: No entities selected
assert not rrn.IsSelected()
selected_ti = TreeItem.GetSelection(mw.entity_tree.window)
assert (selected_ti is None) or (selected_ti == root_ti)
cup_actions = _change_url_prefix_actions_in_top_level_menu(mw)
assertEqual(
[
Expand All @@ -166,6 +162,12 @@ async def test_when_selected_entity_changes_and_top_level_entity_menu_opened_the
]
)

rr = RootResource(project, '', Resource(project, 'https://neocities.org/'))
rr2 = RootResource(project, '', Resource(project, 'https://neocities.org/~distantskies/'))

rrn = root_ti.find_child(rr.resource.url, project.default_url_prefix)
rrn2 = root_ti.find_child(rr2.resource.url, project.default_url_prefix)

# Case: URL with path / selected
rrn.SelectItem()
cup_actions = _change_url_prefix_actions_in_top_level_menu(mw)
Expand Down

0 comments on commit 28facc0

Please sign in to comment.