Giter Club home page Giter Club logo

scommons-react's Introduction

CI Coverage Status scala-index Scala.js

Scala Commons React

Scala.js facades for common React.js utilities and components.

It uses excellent scalajs-reactjs binding/facade library.

How to add it to your project

val scommonsReactVer = "1.0.0-SNAPSHOT"

libraryDependencies ++= Seq(
  "org.scommons.react" %%% "scommons-react-core" % scommonsReactVer,
  "org.scommons.react" %%% "scommons-react-dom" % scommonsReactVer,
  "org.scommons.react" %%% "scommons-react-redux" % scommonsReactVer,
  
  "org.scommons.react" %%% "scommons-react-test" % scommonsReactVer % "test",
  "org.scommons.react" %%% "scommons-react-test-dom" % scommonsReactVer % "test"
)

Latest SNAPSHOT version is published to Sonatype Repo, just make sure you added the proper dependency resolver to your build.sbt settings:

resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"

How to use it

How to Build

To build and run all the tests use the following command:

sbt test

Documentation

You can find more documentation here

scommons-react's People

Contributors

viktor-podzigun avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

finnmerlett

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

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

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

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

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.

Add mockUiComponent test helper

So one could write:

MyComponent.buttonComp = mockUiComponent("MuiButtonMock")

instead of:

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

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.