Skip to content

Commit a0e920c

Browse files
committed
Fix HarmonyOS connection click validation
1 parent e076fd3 commit a0e920c

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

‎crates/extension-runtime/src/connection_import_provider.rs‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
use std::path::{Path, PathBuf};
22

33
use anyhow::{Context, Result};
4+
#[cfg(feature = "wasm-components")]
5+
use connection_import_protocol::ImporterAvailability;
46
use connection_import_protocol::{
5-
CandidateFile, ImportRecord, ImportRecordKind, ImportScanReport, ImporterAvailability,
6-
ImporterCapabilities, ImporterDescriptor, Platform,
7+
CandidateFile, ImportRecord, ImportRecordKind, ImportScanReport, ImporterCapabilities,
8+
ImporterDescriptor, Platform,
79
};
810
#[cfg(feature = "wasm-components")]
911
use extension_component::PermissionSet;
@@ -204,6 +206,7 @@ pub async fn preview_manifest_connection_importers(
204206
Ok(records)
205207
}
206208

209+
#[cfg(feature = "wasm-components")]
207210
fn scan_error_report(importer_id: String, message: String) -> ImportScanReport {
208211
ImportScanReport {
209212
importer_id,

‎main/src/home_tab.rs‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,32 @@ mod external_driver_form_tests {
619619
);
620620
}
621621

622+
#[test]
623+
fn connection_items_route_primary_click_through_open_policy() {
624+
let source = include_str!("home_tab.rs");
625+
let list_item = source
626+
.rsplit("fn render_connection_list_item(")
627+
.next()
628+
.expect("render_connection_list_item exists")
629+
.split("\n fn connection_info_text(")
630+
.next()
631+
.expect("list item render has an end marker");
632+
let card = source
633+
.rsplit("fn render_connection_card(")
634+
.next()
635+
.expect("render_connection_card exists")
636+
.split("impl Focusable for HomePage")
637+
.next()
638+
.expect("card render has an end marker");
639+
640+
for section in [list_item, card] {
641+
assert!(section.contains(".on_click(cx.listener(move |this, _, window, cx| {"));
642+
assert!(section.contains("this.handle_connection_primary_click"));
643+
assert!(section.contains(".on_double_click(cx.listener(move |this, _, w, cx| {"));
644+
assert!(section.contains("if !Self::opens_connection_on_primary_click()"));
645+
}
646+
}
647+
622648
fn sync_conflict(cloud_id: &str) -> SyncConflict {
623649
SyncConflict {
624650
local: StoredConnection::new_database(

0 commit comments

Comments
 (0)