Yew: [stdweb] Add support for the `type` attribute to the `button` element

Created on 19 Nov 2019  Â·  20Comments  Â·  Source: yewstack/yew

Description

I'm submitting a ...

  • feature request
blocked feature

Most helpful comment

@jstarry I would like to work on this feature. Could you please tell me where to start ?

All 20 comments

@jstarry I would like to work on this feature. Could you please tell me where to start ?

@captain-yossarian sure! Here's the key piece: https://github.com/yewstack/yew/blob/master/src/virtual_dom/vtag.rs#L304

Note that we alias "type" as "kind" internally because type is a rust keyword

@jstarry Every time, when I run cargo test I'm getting next error:
error: linking with cc failed: exit code: 1
I've tried all suggestions from this thread -> rust-lang/rust#25289
I have:

  • installed all required packages from CONTRIBUTION.md
  • tried it on Ubuntu 18 and Windows 10
  • asked on yew chat - unfortunately nobody answered
  • also updated rust to last version.

If I run run_tests.sh from ci dir, I see new cmd window for 5 sec, then nothing.
Nothing don't work

Could you please tell me what I'm doing wrong?

@jstarry I'm trying to debug my changes but it hard to figure out how to make things happen.
For example, I've cnahged this line of code to

pub fn add_class(&mut self, class: &str) {
        let cl = "class";
        self.classes.push(cl);
    }

But class of my button component did not change.
Also, it is looks like that set_kind method already exists, but I dont know how to use it properly.

@captain-yossarian oh no, sorry to hear that! Did you go through all of the instructions here:
Contributing - Test Setup

What happens when you run:

cargo test --target wasm32-unknown-unknown --features wasm_test

@jstarry Thanks a lot!

@jstarry I have linked my app to latest yew version and I'm getting next errors:

cargo build --features std_web
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\sergi\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "D:\\rust\\yew-app\\target\\debug\\deps\\yew_app.14se02tsg9vgppee.rcgu.o" 



md5-ca0fe46bddbda5b57b9cc9b2acc772c6



error: failed to run custom build command for yew v0.13.2 (D:\rust\yew)

Caused by:
process didn't exit successfully: D:\rust\yew-app\target\debug\build\yew-f300a951e60e9aaf\build-script-build (exit code: 101)
--- stderr
thread 'main' panicked at 'Selected target x86_64-pc-windows-msvc is not compatible with web-sys', D:\rust\yew\build.rs:28:9
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...
```

@captain-yossarian I think you need to add target so it will build only to webassembly like this
cargo build --target wasm32-unknown-unknown --features web_sys

@fadhlika It works, thank you!

@jstarry @fadhlika
When I'm trying to run either
cargo test --target wasm32-unknown-unknown --features wasm_test std_web
OR
cargo test --target wasm32-unknown-unknown --features wasm_test web_sys
OR
cargo test --target wasm32-unknown-unknown --features wasm_test

I'm receiving:

thread 'main' panicked at 'Yew requires selecting either the `web_sys` or `std_web` cargo feature', build.rs:9:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

But if I run:

cargo test --target wasm32-unknown-unknown --features  std_web

I'm getting:

no tests to run

cargo test --target wasm32-unknown-unknown --features wasm_test std_web

You're telling cargo to run all tests named something with std_web while activating the feature wasm_test. You need to specify the features with --features wasm_test --features std_web or --features wasm_test,std_web.

@jplatte event with either

cargo test --target wasm32-unknown-unknown --features wasm_test --features web_sys

or

cargo test --target wasm32-unknown-unknown --features wasm_test --features std_web

or

cargo test --target wasm32-unknown-unknown --features wasm_test, std_web

I'm getting:

     Running target\wasm32-unknown-unknown\debug\deps\yew-c2b3c4287cf48ca8.wasm
thread 'main' panicked at 'unknown descriptor: 87', C:\Users\sergi\.cargo\registry\src\github.com-1ecc6299db9ec823\wasm-bindgen-cli-support-0.2.58\src\descriptor.rs:145:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: test failed, to rerun pass '--lib'

Try updating wasm-bindgen-cli

On Thu., Mar. 12, 2020, 12:17 a.m. yossarian, notifications@github.com
wrote:

@jplatte https://github.com/jplatte event with either

cargo test --target wasm32-unknown-unknown --features wasm_test --features web_sys

or

cargo test --target wasm32-unknown-unknown --features wasm_test --features std_web

or

cargo test --target wasm32-unknown-unknown --features wasm_test, std_web

I'm getting:

 Running target\wasm32-unknown-unknown\debug\deps\yew-c2b3c4287cf48ca8.wasm

thread 'main' panicked at 'unknown descriptor: 87', C:\Users\sergi.cargo\registry\src\github.com-1ecc6299db9ec823\wasm-bindgen-cli-support-0.2.58\src\descriptor.rs:145:22
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace.
error: test failed, to rerun pass '--lib'

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/yewstack/yew/issues/750#issuecomment-597728087, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AAIGXMPRAD36RH73C4NGJITRG62THANCNFSM4JPJQIZQ
.

@jstarry thank you, it helped

I think this issue can now be closed.

Thanks for the ping, I think this can stay to indicate that stdweb support isn't done yet. I'll update accordingly

@jstarry Once stdweb approve my PR, I will finish my Yew PR

@captain-yossarian I think that your PR has been stuck for quite a while – perhaps the maintainer of stdweb is no longer maintaining stdweb?

They haven't specifically said that it's no longer maintained. I think it's fine to leave this open until it's confirmed. We still have devs using stdweb

Agreed!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FrontMage picture FrontMage  Â·  4Comments

djahandarie picture djahandarie  Â·  3Comments

alun picture alun  Â·  4Comments

IngwiePhoenix picture IngwiePhoenix  Â·  4Comments

ghost picture ghost  Â·  4Comments