I am trying to create a unit test that requires me to mock the Element class
So my code looks something like
import 'dart:html';
import 'package:unittest/unittest.dart';
import 'package:mock/mock.dart';
@proxy
class MockElement extends Mock implements Element{}
void main(){
test("",(){
MockView view = new MockView();
MockElement element = new MockElement();
When I run this I get the following message
The built-in library 'dart:html' is not available on the stand-alone VM. 'file:///C:/Users/Schmidt/Documents/GitHub/PicasaWebAlbumDisplay/test/picasaphotopresentor_test.dart': error: line 1 pos 1: library handler failed import 'dart:html'; ^
I need to import html to have the definition of the Element class, so I am stuck at this point.
Any ideas?
Depending on your requirements, you may be able to use html5lib. However, it is not yet fully compatible with dart:html, but aims to be.
Another option worth exploring is testing with a headless browser. See this example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With