summaryrefslogtreecommitdiffstats
path: root/test/src/selector.rs
diff options
context:
space:
mode:
Diffstat (limited to 'test/src/selector.rs')
-rw-r--r--test/src/selector.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/src/selector.rs b/test/src/selector.rs
new file mode 100644
index 00000000..54faa1a9
--- /dev/null
+++ b/test/src/selector.rs
@@ -0,0 +1,24 @@
+use crate::core::text;
+use crate::core::widget;
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub enum Selector {
+ Id(widget::Id),
+ Text(text::Fragment<'static>),
+}
+
+impl From<widget::Id> for Selector {
+ fn from(id: widget::Id) -> Self {
+ Self::Id(id)
+ }
+}
+
+impl From<&'static str> for Selector {
+ fn from(id: &'static str) -> Self {
+ Self::Id(widget::Id::new(id))
+ }
+}
+
+pub fn text(fragment: impl text::IntoFragment<'static>) -> Selector {
+ Selector::Text(fragment.into_fragment())
+}