// vIEw interface has no reference to dart:HTMLabstract class VIEw { hello();}// vIEw impl uses dart:HTML but hands of all logic to the presenterclass VIEwImpl implements VIEw { VIEw(this._presenter) { var link = new Element.HTML("<a href="">a link</a>"); link.on.click.add(_presenter.onClick()); body.nodes.add(link); } hello() { body.nodes.add(new Element.HTML("<p>Hello from presenter</p>"); } Presenter _presenter;}// presenter acts on the VIEw interface and can therefor be tested with a mock.class Presenter { Presenter(this._vIEw); onClick() => _vIEw.hello(); VIEw _vIEw;}总结
以上是内存溢出为你收集整理的Dart Mocking HTML库全部内容,希望文章能够帮你解决Dart Mocking HTML库所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)