dom_stub 0.0.4

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 21

dom_stub

A library for Dart developers. Implementing 'dart:js'. It allows to run browser test in VM mode.

Usage

Try It Now

Add the js_mimicry package to your pubspec.yaml file:

dependencies:
  dom_stub: ">=0.0.1 <0.1.0"

Building and Deploying

To build a deployable version of your test, add the dom_stub transformers to your pubspec.yaml file:

transformers:
- dom_stub

A simple usage example:

DOM_STUB="true" pub serve
pub run test --pub-serve=8080 -p vm

dart:html support

Now 'dart:html' library supported via mockito. Usage:

when(window.location.hash).thenReturn('#');
expect(window.location.hash, "#");

At this moment only window object mocked.

replace any import

transformers:
 - dom_stub:
      imports: { 'browser_cfg.dart': 'vm_cfg.dart' }

Replace 'browser_cfg.dart' to 'vm_cfg.dart'

Features and bugs

Please file feature requests and bugs at the issue tracker.

Changelog

0.0.4

  • upgrade code_transformers >=0.4.2 <0.4.3

0.0.3

  • implemented replacing in export

0.0.2

  • custom import replacing via pubspec.yaml
  • 'dart:html' library supported via mockito

0.0.1

  • Initial version, support 'dart:js'

Use this package as a library

1. Depend on it

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


dependencies:
  dom_stub: "^0.0.4"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


      import 'package:dom_stub/dom_stub.dart';
  
Version Uploaded Documentation Archive
0.0.4 Apr 1, 2016 Go to the documentation of dom_stub 0.0.4 Download dom_stub 0.0.4 archive
0.0.3 Aug 21, 2015 Go to the documentation of dom_stub 0.0.3 Download dom_stub 0.0.3 archive
0.0.2 Jun 28, 2015 Go to the documentation of dom_stub 0.0.2 Download dom_stub 0.0.2 archive
0.0.1+1 Jun 21, 2015 Go to the documentation of dom_stub 0.0.1+1 Download dom_stub 0.0.1+1 archive
0.0.1 Jun 21, 2015 Go to the documentation of dom_stub 0.0.1 Download dom_stub 0.0.1 archive

Analysis

We analyzed this package on May 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.54.0
  • pana: 0.11.1

Scores

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

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:dom_stub/dom_stub.dart.

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 5 errors 16 hints.

    Strong-mode analysis of lib/src/js/js_array.dart failed with the following error:

    line: 38 col: 3
    Invalid override. The type of 'JsArray.[]=' ('(dynamic, E) → void') isn't a subtype of 'JsObject.[]=' ('(dynamic, dynamic) → void').

    Strong-mode analysis of lib/src/js/js_object.dart failed with the following error:

    line: 44 col: 12
    The method '_fromBrowserObject' isn't defined for the class 'JsObject'.

    Similar analysis of the following files failed:

    • lib/transformer.dart (error)
    • lib/dom_stub.dart (hint)
    • lib/src/html/window.dart (hint)
    • lib/src/js/js_function.dart (hint)
    • lib/src/js/js_property.dart (hint)
    • lib/src/js/js_stub.dart (hint)
  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use dom_stub.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.9.3 <2.0.0
code_transformers >=0.4.2 <0.4.3 0.4.2+4 0.5.1+5
mockito >=0.10.0 <0.11.0 0.10.1 2.2.3
Transitive dependencies
analyzer 0.29.11 0.32.0
args 0.13.7 1.4.3
async 2.0.7
barback 0.15.2+16
boolean_selector 1.0.3
charcode 1.1.1
cli_util 0.0.1+2 0.1.3
collection 1.14.9
convert 2.0.1
crypto 2.0.3
csslib 0.14.4
glob 1.1.5
html 0.13.3
http 0.11.3+16
http_multi_server 2.0.4
http_parser 3.1.2
io 0.3.2+1
isolate 1.1.0 2.0.0
js 0.6.1
logging 0.11.3+1
matcher 0.12.2+1
meta 1.1.5
mime 0.9.6+1
multi_server_socket 1.0.1
node_preamble 1.4.1
package_config 1.0.3
package_resolver 1.0.2
path 1.5.1
plugin 0.2.0+2
pool 1.3.5
pub_semver 1.4.1
shelf 0.7.3 0.7.3+1
shelf_packages_handler 1.0.3
shelf_static 0.2.7 0.2.7+1
shelf_web_socket 0.2.2+1
source_map_stack_trace 1.1.4
source_maps 0.10.5
source_span 1.4.0
stack_trace 1.9.2
stream_channel 1.6.6
string_scanner 1.0.2
term_glyph 1.0.0
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+7
web_socket_channel 1.0.7
when 0.2.0
which 0.1.3
yaml 2.1.14
Dev dependencies
test >=0.12.0 <0.13.0 0.12.37 0.12.38+1