summaryrefslogtreecommitdiff
path: root/crates/typst-ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/typst-ide')
-rw-r--r--crates/typst-ide/src/complete.rs9
-rw-r--r--crates/typst-ide/src/tests.rs6
2 files changed, 13 insertions, 2 deletions
diff --git a/crates/typst-ide/src/complete.rs b/crates/typst-ide/src/complete.rs
index 47727743..53642331 100644
--- a/crates/typst-ide/src/complete.rs
+++ b/crates/typst-ide/src/complete.rs
@@ -1848,4 +1848,13 @@ mod tests {
.must_include(["\"New Computer Modern Math\""])
.must_exclude(["\"Libertinus Serif\""]);
}
+
+ #[test]
+ fn test_autocomplete_typed_html() {
+ test("#html.div(translate: )", -2)
+ .must_include(["true", "false"])
+ .must_exclude(["\"yes\"", "\"no\""]);
+ test("#html.input(value: )", -2).must_include(["float", "string", "red", "blue"]);
+ test("#html.div(role: )", -2).must_include(["\"alertdialog\""]);
+ }
}
diff --git a/crates/typst-ide/src/tests.rs b/crates/typst-ide/src/tests.rs
index 5edc05f1..dd5c230a 100644
--- a/crates/typst-ide/src/tests.rs
+++ b/crates/typst-ide/src/tests.rs
@@ -10,7 +10,7 @@ use typst::syntax::package::{PackageSpec, PackageVersion};
use typst::syntax::{FileId, Source, VirtualPath};
use typst::text::{Font, FontBook, TextElem, TextSize};
use typst::utils::{singleton, LazyHash};
-use typst::{Library, World};
+use typst::{Feature, Library, World};
use crate::IdeWorld;
@@ -168,7 +168,9 @@ fn library() -> Library {
// Set page width to 120pt with 10pt margins, so that the inner page is
// exactly 100pt wide. Page height is unbounded and font size is 10pt so
// that it multiplies to nice round numbers.
- let mut lib = typst::Library::default();
+ let mut lib = typst::Library::builder()
+ .with_features([Feature::Html].into_iter().collect())
+ .build();
lib.styles
.set(PageElem::set_width(Smart::Custom(Abs::pt(120.0).into())));
lib.styles.set(PageElem::set_height(Smart::Auto));