| 1282 |
1282 |
|
);
|
| 1283 |
1283 |
|
}
|
| 1284 |
1284 |
|
|
|
1285 |
+ |
/// A tag link that carries no `mode` filters items rather than landing on the
|
|
1286 |
+ |
/// unfiltered project list.
|
|
1287 |
+ |
///
|
|
1288 |
+ |
/// Six templates emit `/discover?tag={slug}` with no mode (item, project, both
|
|
1289 |
+ |
/// players, and the two reader views), so this is every tag click from a
|
|
1290 |
+ |
/// content page. Projects mode has no tag dimension at all — `discover_projects`
|
|
1291 |
+ |
/// takes no tag argument and the sidebar only builds tag filters in items mode
|
|
1292 |
+ |
/// — so the URL used to claim a filter the query could not apply, and the page
|
|
1293 |
+ |
/// answered with every project, which reads as "this tag matches everything".
|
|
1294 |
+ |
#[tokio::test]
|
|
1295 |
+ |
async fn a_tag_link_without_a_mode_filters_items() {
|
|
1296 |
+ |
let mut h = TestHarness::new().await;
|
|
1297 |
+ |
let (_, electronic) =
|
|
1298 |
+ |
make_discoverable_item(&mut h, "bareelec", "Electronic Pick", "audio").await;
|
|
1299 |
+ |
let (_, folk) = make_discoverable_item(&mut h, "barefolk", "Folk Pick", "audio").await;
|
|
1300 |
+ |
tag_item(&h, &electronic, "audio.genre.electronic").await;
|
|
1301 |
+ |
tag_item(&h, &folk, "audio.genre.folk").await;
|
|
1302 |
+ |
|
|
1303 |
+ |
let resp = h.client.get("/discover?tag=audio.genre.electronic").await;
|
|
1304 |
+ |
assert_eq!(resp.status, 200);
|
|
1305 |
+ |
assert!(
|
|
1306 |
+ |
resp.text.contains("Electronic Pick"),
|
|
1307 |
+ |
"a bare tag link must return the tagged item",
|
|
1308 |
+ |
);
|
|
1309 |
+ |
assert!(
|
|
1310 |
+ |
!resp.text.contains("Folk Pick"),
|
|
1311 |
+ |
"a bare tag link must still exclude an unselected tag",
|
|
1312 |
+ |
);
|
|
1313 |
+ |
}
|
|
1314 |
+ |
|
|
1315 |
+ |
/// And the default is otherwise unchanged: no tag, no mode, still projects.
|
|
1316 |
+ |
/// Pinned because the tag rule above is a second default rather than a
|
|
1317 |
+ |
/// replacement, and the two are easy to collapse into one by accident.
|
|
1318 |
+ |
#[tokio::test]
|
|
1319 |
+ |
async fn discover_without_a_tag_still_defaults_to_projects() {
|
|
1320 |
+ |
let mut h = TestHarness::new().await;
|
|
1321 |
+ |
make_discoverable_item(&mut h, "defmode", "Mode Default Pick", "audio").await;
|
|
1322 |
+ |
|
|
1323 |
+ |
let resp = h.client.get("/discover").await;
|
|
1324 |
+ |
assert_eq!(resp.status, 200);
|
|
1325 |
+ |
assert!(
|
|
1326 |
+ |
resp.text.contains("project-row"),
|
|
1327 |
+ |
"the bare landing view is the project list",
|
|
1328 |
+ |
);
|
|
1329 |
+ |
}
|
|
1330 |
+ |
|
| 1285 |
1331 |
|
/// Repeated `item_type=` params are OR'd.
|
| 1286 |
1332 |
|
#[tokio::test]
|
| 1287 |
1333 |
|
async fn repeated_item_type_params_are_ored_within_the_facet() {
|