Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

angularjs部分使用技巧 #6

Open
leopen-hu opened this issue Mar 17, 2017 · 1 comment
Open

angularjs部分使用技巧 #6

leopen-hu opened this issue Mar 17, 2017 · 1 comment

Comments

@leopen-hu
Copy link
Owner

leopen-hu commented Mar 17, 2017

记录一些angularJs1.x的使用技巧

@leopen-hu
Copy link
Owner Author

leopen-hu commented Mar 17, 2017

测试:
测试 controller,如果使用含有数据的 dataService,同时该服务基于 html5 的元素,在 photomjs 中会报错,此时可以 mock 整个 dataservice。
demo 代码如下:

beforeEach(function() {
  audioServiceMock = {
    errorAudio: { play: function() { return 'errorAudio'; } },
    successAudio: { play: function() { return 'successAudio'; } }
  }
});

beforeEach(inject(function(_$httpBackend_, $rootScope, $controller, _PickingWaveService_) {
  vm = $controller('PackingIntoPackagesController', { $scope: scope, audioService: audioServiceMock });
}

@leopen-hu leopen-hu added vue 2.x and removed vue 2.x labels Dec 21, 2017
@leopen-hu leopen-hu reopened this Dec 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant