scommons / scommons-react Goto Github PK
View Code? Open in Web Editor NEWScala.js facades for core React.js APIs, components and hooks
Home Page: https://scommons.github.io/scommons-react/
License: Apache License 2.0
Scala.js facades for core React.js APIs, components and hooks
Home Page: https://scommons.github.io/scommons-react/
License: Apache License 2.0
So one can write:
assertComponents(result.children, List(
<.div()("Item #1"),
<.div()("test 1")
))
instead of:
inside(result.children.toList) { case List(child1, child2) =>
assertNativeComponent(child1, <.div()("Item #1"))
assertNativeComponent(child2, <.div()("test 1"))
}
So it can be used in the render test cases like this:
val someChildComp: UiComponent[SomeChildProps] = mockUiComponent(???)
assertNativeComponent(result,
<(someChildComp())(^.assertWrapped(inside(_) { case SomeChildProps(prop1, prop2) =>
prop1 shouldBe ???
prop2 shouldBe ???
}))()
)
It would be handy to have common reusable TestErrorBoundary
test utility component to catch rendering/context errors in tests.
Allow to pass instances of ReactClassElementSpec
class to TestRendererUtils.findComponents
method, so we can write:
findComponents(renderer.root, <.TextInput)
instead of:
findComponents(renderer.root, <.TextInput.reactClass)
Define test types in package object for easy import:
import scommons.react.test._
Currently its printing:
10 was not equal to 11
while more meaningful error message should be:
Count of children doesn't match for <component>:
expected 11 but actual was 10
Add type aliases to redux
package object, so its possible to use single import
:
import scommons.react.redux._
instead of:
import io.github.shogowada.scalajs.reactjs.redux.Action
import io.github.shogowada.scalajs.reactjs.redux.Redux.Dispatch
So one could write:
MyComponent.buttonComp = mockUiComponent("MuiButtonMock")
instead of:
MyComponent.buttonComp = () => "MuiButtonMock".asInstanceOf[ReactClass]
For example, currently we may see such failed assertion error when number of children doesn't match to the expected for component:
error: 2 was not equal to 1
but it's not clear for which parent element in the tree it failed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.