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

Make FuncUnit use async/await rather than a queue system #229

Open
matthewp opened this issue Nov 1, 2018 · 1 comment
Open

Make FuncUnit use async/await rather than a queue system #229

matthewp opened this issue Nov 1, 2018 · 1 comment

Comments

@matthewp
Copy link
Contributor

matthewp commented Nov 1, 2018

This is a future proposal that needs to be more fully thoroughly thought out.

@justinbmeyer
Copy link
Member

I'd also like to throw in making it very functional.

import FuncUnit as F from "funcunit"

test(async function(){
  await F.click( querySelector("#button") )
  await F.textContent( querySelector("#details"), "Hi there" )
  assert(true, "text is hi there")
})

F would just expose functions that return promises. await use would be expected. We'd have functions that would be similar to what we have now, but more DOM-focused APIs and less jQuery-focused APIs:

  • textContent instead of text
  • innerHTML instead of html
  • value instead val

I think we could get rid of many traversal methods. For example

await F.click( querySelector("#button") )
await F.textContent( querySelector("#details").parentNode , "Hi there" )
assert(true, "text is hi there")

Though we still might want some form of "wait" with traversal:

await F.click( querySelector("#button") )

details = await F.querySelector("#details")
child = await F.querySelector(child, ".someElement"); // obviously this could be done with one call
await F.textContent( child, "Hi there" )
assert(true, "text is hi there")

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

No branches or pull requests

2 participants