feat: select matching mobile work in one step (Closes #669)
This commit is contained in:
1 parent
0fbe047e03
commit
8edd542379
5 files changed
+110
-1
No files matched your search
@@ -29,6 +29,70 @@ TODAY_WORK = Path(__file__).parents[1] / "frontend" / "today-work.js"
|
||||
WORK_SELECTION = Path(__file__).parents[1] / "frontend" / "work-selection.js"
|
||||
|
||||
|
||||
def test_work_selection_selects_matching_items_in_order_with_an_explicit_cap():
|
||||
script = f"""
|
||||
const createWorkSelection = require({json.dumps(str(WORK_SELECTION))});
|
||||
const selection = createWorkSelection({{limit:3}});
|
||||
selection.start();
|
||||
selection.select({{kind:'issue', repository:'stackchain/api', number:1}});
|
||||
const result = selection.selectMany([
|
||||
{{kind:'issue', repository:'stackchain/api', number:1}},
|
||||
{{kind:'pull', repository:'stackchain/web', number:2}},
|
||||
{{kind:'issue', repository:'stackchain/app', number:3}},
|
||||
{{kind:'issue', repository:'stackchain/overflow', number:4}},
|
||||
]);
|
||||
process.stdout.write(JSON.stringify({{result, snapshot:selection.snapshot()}}));
|
||||
"""
|
||||
result = subprocess.run(
|
||||
["node", "-e", script], check=True, capture_output=True, text=True
|
||||
)
|
||||
output = json.loads(result.stdout)
|
||||
|
||||
assert output == {
|
||||
"result": {"status": "limit", "added": 2, "count": 3, "limit": 3},
|
||||
"snapshot": {
|
||||
"active": True,
|
||||
"count": 3,
|
||||
"ids": [
|
||||
"issue:stackchain/api:1:",
|
||||
"pull:stackchain/web:2:",
|
||||
"issue:stackchain/app:3:",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def test_work_selection_clears_matches_without_leaving_selection_mode():
|
||||
script = f"""
|
||||
const createWorkSelection = require({json.dumps(str(WORK_SELECTION))});
|
||||
const selection = createWorkSelection();
|
||||
selection.start();
|
||||
selection.selectMany([
|
||||
{{kind:'issue', repository:'stackchain/api', number:1}},
|
||||
{{kind:'pull', repository:'stackchain/web', number:2}},
|
||||
]);
|
||||
process.stdout.write(JSON.stringify(selection.clear()));
|
||||
"""
|
||||
result = subprocess.run(
|
||||
["node", "-e", script], check=True, capture_output=True, text=True
|
||||
)
|
||||
|
||||
assert json.loads(result.stdout) == {"active": True, "count": 0, "ids": []}
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_mobile_batch_planning_can_select_and_clear_active_queue_matches():
|
||||
html = await dashboard()
|
||||
|
||||
assert 'id="select-matching-work"' in html
|
||||
assert 'id="clear-work-selection"' in html
|
||||
assert "workSelection.selectMany(visible)" in html
|
||||
assert "workSelection.clear()" in html
|
||||
assert "matches selected" in html
|
||||
assert ".selection-scope-actions button { min-height:44px;" in html
|
||||
assert "max-width:100%" in html
|
||||
|
||||
|
||||
def test_queue_finder_matches_repository_number_and_title_without_reordering():
|
||||
script = f"""
|
||||
const work = require({json.dumps(str(MY_WORK))});
|
||||
|
||||
Reference in new issue
Block a user