Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input current value sync #1268

Merged
merged 4 commits into from
May 28, 2020
Merged

Input current value sync #1268

merged 4 commits into from
May 28, 2020

Conversation

ShadoySV
Copy link
Contributor

@ShadoySV ShadoySV commented May 27, 2020

Places input current value into last tag state before comparing it with new one

Fixes #233

Checklist:

  • I have ran ./ci/run_stable_checks.sh
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works

@jstarry
Copy link
Member

jstarry commented May 28, 2020

Thanks @ShadoySV! Could you please add a test for this?

I think this test is a decent reference to how it would be done:

let ancestor = vtag;
let elem = html! { <div class=("class-1", "class-2", "class-3")></div> };
let mut vtag = if let VNode::VTag(vtag) = elem {
vtag
} else {
panic!("should be vtag")
};
vtag.apply(&scope, &parent, None, Some(VNode::VTag(ancestor)));
let expected = "class-1 class-2 class-3";
assert_eq!(get_class_str(&vtag), expected);
assert_eq!(
vtag.reference
.as_ref()
.unwrap()
.get_attribute("class")
.unwrap(),

To run tests first follow: https://github.com/yewstack/yew/blob/master/CONTRIBUTING.md#web-tests and then run one of the commands here: https://github.com/yewstack/yew/blob/master/CONTRIBUTING.md#running-tests

@jstarry
Copy link
Member

jstarry commented May 28, 2020

Thank you! I just fixed the merge conflict and will merge when CI passes 👍

@jstarry jstarry merged commit f65bd26 into yewstack:master May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting the current value of an input?
2 participants