angularjs - 如何使用业力,茉莉花在AngularJS中测试html页面标题
问题描述
我想在 angularJS 中测试 html 页面标题作为我的单元案例之一。我的控制器的名称是“MainController”。我可以在没有控制器范围的情况下访问标题吗?
describe('Testing Currency App',function(){ beforeEach(module('currencyConv'));
describe('Testing Currency App Controller',function(){
var scope = {};
var ctrl;
beforeEach(inject(function($controller,$rootScope){
scope = $rootScope.$new();
ctrl = $controller('MainController', {$scope:scope});
rootScope = $rootScope;
}));
it('should initialise the title',function(){
expect(scope.title).toBeDefined();
expect(scope.title).toBe('Angular Currency Converter');
});
});
});
我是新来的
解决方案
推荐阅读
- javascript - 反应 useEffect 和 useCallback linting 错误 - 缺少依赖项
- java - Angular 前端与 Spring 后端安全性对话
- c++ - Sutherland Hodgman 算法我做错了什么?
- python - FastBlur 可以模糊它背后的一切吗?
- javascript - 如何为 ie11 的 String.repeat 函数添加 polyfill?
- javascript - java - 如何从java脚本中每个具有相同类名的特定按钮更改多个文本框值?
- python - 将 Pandas df 转换为 rda 文件
- python - win32print 打印空的pdf文件
- combobox - 功能区 XML - 在组合框控件中获取选定的索引或项目 ID
- java - Java volatile 关键字 - 为什么此代码终止