setup done, local tests work, check workflow

This commit is contained in:
t1m0t 2022-02-03 00:11:38 +01:00
parent 24d78682ad
commit f1865faef7
7 changed files with 36 additions and 11 deletions

View file

@ -32,7 +32,7 @@ jobs:
override: true override: true
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
- run: sudo apt-get update - run: sudo apt-get update
- run: sudo apt install libwebkit2gtk-4.0-dev libappindicator3-dev libgtk-3-dev - run: sudo apt install libwebkit2gtk-4.0-dev libappindicator3-dev libgtk-3-dev firefox-csr
- name: Install cargo-make - name: Install cargo-make
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:

View file

@ -13,3 +13,8 @@ license = "MIT/Apache-2.0"
[dependencies] [dependencies]
dioxus-desktop = { path = "../desktop", version = "^0.1.6" } dioxus-desktop = { path = "../desktop", version = "^0.1.6" }
[lib]
doctest = false
# tests suspended until package ready
test = false

View file

@ -0,0 +1,7 @@
[tasks.test]
command = "cargo"
args = [
"test",
"--no-run",
]

View file

@ -43,6 +43,7 @@ web = ["web-sys", "gloo", "js-sys", "wasm-bindgen"]
desktop = [] desktop = []
mobile = [] mobile = []
derive = [] derive = []
wasm_test = []
[dev-dependencies] [dev-dependencies]
console_error_panic_hook = "0.1.7" console_error_panic_hook = "0.1.7"
@ -50,3 +51,10 @@ dioxus-web = { path = "../web" }
log = "0.4.14" log = "0.4.14"
wasm-logger = "0.2.0" wasm-logger = "0.2.0"
wasm-bindgen-test = "0.3" wasm-bindgen-test = "0.3"
gloo-utils = "0.1.2"
[dev-dependencies.web-sys]
version = "0.3"
features = [
"Document",
]

View file

@ -1,4 +1,6 @@
[tasks.test] [tasks.test]
extend = "core::wasm-pack-base"
command = "wasm-pack"
args = [ args = [
"test", "test",
"@@split(DIOXUS_TEST_FLAGS, )", "@@split(DIOXUS_TEST_FLAGS, )",
@ -6,5 +8,3 @@ args = [
"--features", "--features",
"${DIOXUS_TEST_FEATURES}", "${DIOXUS_TEST_FEATURES}",
] ]
command = "wasm-pack"
extend = "core::wasm-pack-base"

View file

@ -52,17 +52,12 @@ fn simple_test() {
cx.render(rsx! { cx.render(rsx! {
div { div {
id: "test1",
id
} }
}) })
} }
main(); main();
let element = gloo_utils::document() let element = gloo_utils::document();
.get_element_by_id("test1")
.expect("No result found. Most likely, the application crashed")
.inner_html();
assert!(element, "");
} }

View file

@ -0,0 +1,10 @@
{
"moz:firefoxOptions": {
"binary": "/usr/bin/firefox",
"prefs": {
"media.navigator.streams.fake": true,
"media.navigator.permission.disabled": true
},
"args": []
}
}