over_react_test 2.4.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 67

OverReact Test #

Pub Build Status Test Coverage Documentation

A library for testing OverReact components.

Using it in your project #

  1. Import it into your test files:

     import 'package:over_react_test/over_react_test.dart';
    
  2. Add the test/pub_serve transformer to your pubspec.yaml after the over_react transformer.

     transformers:
     - over_react
     - test/pub_serve:
         $include: test/**_test{.*,}.dart
     - $dart2js
    
  3. Use the --pub-serve option when running your tests:

     $ pub run test --pub-serve=8081 test/your_test_file.dart
    

    Note: 8081 is the default port used, but your project may use something different. Be sure to take note of the output when running pub serve to ensure you are using the correct port.

Naming Conventions #

Variables and Types #

UsageActual TypeSuggested Referencing
render and render helper functionsReactComponent |Elementinstance
Component classReactClasstype
VDOM Instance (invoked UiProps)ReactElement-ReactElement or not suffixed
findDomNode, queryByTestId, etc.Elementnode
The Dart componentreact.Component (backed by ReactComponent)dartInstance
Invoked UiFactoryUiPropsbuilder

Example:

test('my test' () {
  var sampleBuilder = Sample();
  var sampleReactElement = sampleBuilder(); // Or var sample = sampleBuilder();
  var instance = render(sampleInstance);
  SampleComponent sampleDartInstance = getDartComponent(instance);
  var sampleNode = findDomNode(instance);
});

Test IDs #

When coming up with test ID strings:

  • DO NOT use spaces; space-delimited strings will be treated as separate test IDs

    Just like CSS class names, you can use multiple test IDs together, and use any one of them to target a given component/node.

  • PREFER following our naming scheme for consistency across projects:

    <library>.<Component>[.<subpart>...].<part>

    We recommend including a library abbreviation and component name within a test ID so that it's easy to track down where that ID came from.

    Namespacing (.<subpart>) can be added however it makes sense.

    Finally, test IDs should be descriptive and useful in the context of tests.

    Examples:

    • wsd.DatepickerPrimitive.goToSelectedButton
    • sox.AbstractDataLayoutGroup.headerBlock.title
  • CONSIDER adding multiple IDs to serve different purposes

    for (var i = 0; i < items.length; i++) {
      // ...
        ..addTestId('foo.Bar.menuItem')
        ..addTestId('foo.Bar.menuItem.$i')
        ..addTestId('foo.Bar.menuItem.${items[i].id}')
      // ...
    }
    

    With the output of above code, you can:

    • target all of the Bar component's menu items using foo.Bar.menuItem
    • target the 4th item using foo.Bar.menuItem.3
    • target the item corresponding to an item with id baz123 using foo.Bar.menuItem.baz123

    This won't always be needed, but it comes in handy in certain cases.

Documentation #

You would never skip reading the docs for a new language you are asked to learn, so please don't skip over reading our API documentation either.

Contributing #

Yes please! (Please read our contributor guidelines first)

Versioning #

The over_react_test library adheres to Semantic Versioning:

  • Any API changes that are not backwards compatible will bump the major version (and reset the minor / patch).
  • Any new functionality that is added in a backwards-compatible manner will bump the minor version (and reset the patch).
  • Any backwards-compatible bug fixes that are added will bump the patch version.

OverReact Test Changelog #

2.0.0 #

New Features

  • Dart 2 compatible!

Breaking Changes

  • The getComponentPropKeys() and testPropForwarding() functions have been removed, as they depended on dart:mirrors. Once there is a Dart-2-only release of over_react, this function will be re-added and will rely on information generated by the builder rather than using mirrors.

  • The commonComponentTests() function no longer calls testPropForwarding() since it has been removed. In other words, the shouldTestPropForwarding parameter is effectively a no-op until testPropForwarding() can be re-added.

1.1.1 #

Bugs Fixed

  • Sync common component test src with the lib it originated from.

1.1.0 #

New Features

  • #11: Add some test utilities that were left in over_react when the library was first created.

1.0.1 #

Misc

  • #8: Update prop error message to make it more DDC friendly

1.0.0 #

Initial public release of library.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  over_react_test: ^2.4.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:over_react_test/over_react_test.dart';
  
Version Uploaded Documentation Archive
2.4.1 Mar 14, 2019 Go to the documentation of over_react_test 2.4.1 Download over_react_test 2.4.1 archive
2.4.0 Mar 6, 2019 Go to the documentation of over_react_test 2.4.0 Download over_react_test 2.4.0 archive
2.3.0 Feb 8, 2019 Go to the documentation of over_react_test 2.3.0 Download over_react_test 2.3.0 archive
2.2.0 Jan 24, 2019 Go to the documentation of over_react_test 2.2.0 Download over_react_test 2.2.0 archive
2.1.0 Jan 24, 2019 Go to the documentation of over_react_test 2.1.0 Download over_react_test 2.1.0 archive
2.0.0 Jan 4, 2019 Go to the documentation of over_react_test 2.0.0 Download over_react_test 2.0.0 archive
1.6.0 Dec 21, 2018 Go to the documentation of over_react_test 1.6.0 Download over_react_test 1.6.0 archive
1.5.0 Aug 11, 2018 Go to the documentation of over_react_test 1.5.0 Download over_react_test 1.5.0 archive
1.4.0 May 15, 2018 Go to the documentation of over_react_test 1.4.0 Download over_react_test 1.4.0 archive
1.3.2 May 8, 2018 Go to the documentation of over_react_test 1.3.2 Download over_react_test 1.3.2 archive

All 18 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
56
Health:
Code health derived from static analysis. [more]
82
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
72
Overall:
Weighted score of the above. [more]
67
Learn more about scoring.

We analyzed this package on Apr 24, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: web

Primary library: package:over_react_test/over_react_test.dart with components: html, js.

Health suggestions

Fix lib/src/over_react_test/common_component_util.dart. (-8.63 points)

Analysis of lib/src/over_react_test/common_component_util.dart reported 18 hints, including:

line 15 col 8: Unused import: 'dart:collection'.

line 19 col 47: The name CssClassPropsMixin is shown, but not used.

line 19 col 67: The name DomPropsMixin is shown, but not used.

line 20 col 26: The name ReactPropsMixin is shown, but not used.

line 20 col 43: The name UbiquitousDomPropsMixin is shown, but not used.

Fix lib/src/over_react_test/react_util.dart. (-5.36 points)

Analysis of lib/src/over_react_test/react_util.dart reported 11 hints, including:

line 128 col 62: Use = to separate a named parameter from its default value.

line 134 col 27: Use = to separate a named parameter from its default value.

line 261 col 62: Use = to separate a named parameter from its default value.

line 308 col 74: Use = to separate a named parameter from its default value.

line 344 col 100: Use = to separate a named parameter from its default value.

Fix lib/src/over_react_test/jacket.dart. (-1.99 points)

Analysis of lib/src/over_react_test/jacket.dart reported 4 hints:

line 48 col 28: Use = to separate a named parameter from its default value.

line 49 col 22: Use = to separate a named parameter from its default value.

line 66 col 97: Use = to separate a named parameter from its default value.

line 66 col 123: Use = to separate a named parameter from its default value.

Fix additional 4 files with analysis or formatting issues. (-2.99 points)

Additional issues in the following files:

  • lib/src/over_react_test/js_component.dart (3 hints)
  • lib/src/over_react_test/dom_util.dart (2 hints)
  • lib/src/over_react_test/custom_matchers.dart (1 hint)
  • lib/src/over_react_test/validation_util.dart (Run dartfmt to format lib/src/over_react_test/validation_util.dart.)

Maintenance suggestions

The package description is too short. (-18 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and over_react_test.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.24.2 <3.0.0
js ^0.6.1 0.6.1+1
matcher ^0.12.1+4 0.12.5
over_react >=1.31.0 <3.0.0 2.4.1+dart2
react >=3.7.0 <5.0.0 4.6.2
test >=0.12.32+1 <2.0.0 1.6.2
Transitive dependencies
analyzer 0.35.4 0.36.1
args 1.5.1
async 2.2.0
boolean_selector 1.0.4
build 1.1.3
built_collection 4.2.0
built_redux 7.5.3
built_value 6.4.0
charcode 1.1.2
cli_repl 0.2.0+1
collection 1.14.11
convert 2.1.1
crypto 2.0.6
dart2_constant 1.0.2+dart2
dart_style 1.2.4 1.2.7
fixnum 0.10.9
front_end 0.1.14 0.1.16
glob 1.1.7
http 0.12.0+2
http_multi_server 2.0.5
http_parser 3.1.3
intl 0.15.8
io 0.3.3
json_rpc_2 2.1.0
kernel 0.3.14 0.3.16
logging 0.11.3+2
meta 1.1.7
mime 0.9.6+2
multi_server_socket 1.0.2
node_preamble 1.4.4
package_config 1.0.5
package_resolver 1.0.10
path 1.6.2
pedantic 1.5.0
platform_detect 1.3.5
pool 1.4.0
pub_semver 1.4.2
quiver 0.29.0+2 2.0.3
sass 1.19.0
shelf 0.7.5
shelf_packages_handler 1.0.4
shelf_static 0.2.8
shelf_web_socket 0.2.3
source_gen 0.9.4+2
source_map_stack_trace 1.1.5
source_maps 0.10.8
source_span 1.5.5
stack_trace 1.9.3
stream_channel 2.0.0
stream_transform 0.0.17
string_scanner 1.0.4
term_glyph 1.1.0
test_api 0.2.5
test_core 0.2.4
transformer_utils 0.2.1
tuple 1.0.2
typed_data 1.1.6
vm_service_client 0.2.6+1
w_common 1.17.0
w_flux 2.10.1
watcher 0.9.7+10
web_socket_channel 1.0.12
yaml 2.1.15
Dev dependencies
build_runner >=0.6.0 <2.0.0
build_test >=0.9.4 <=0.11.0
build_web_compilers >=0.2.0 <2.0.0
coverage >=0.7.2 <0.12.4
dart_dev >=1.9.6 <3.0.0
dependency_validator ^1.2.2