Giter Club home page Giter Club logo

scommons-react's Issues

Add assertComponents test helper

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"))
}

Add assertWrapped prop test helper

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 ???
  }))()
)

Improve component children count assertion

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

Simplify redux related imports

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

Add mockUiComponent test helper

So one could write:

MyComponent.buttonComp = mockUiComponent("MuiButtonMock")

instead of:

MyComponent.buttonComp = () => "MuiButtonMock".asInstanceOf[ReactClass]

Improve test assertions error messages

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.