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.

Libraries

dom_stub

The dom_stub library.

dom_stub.transformer