04 2020 档案
摘要:Jasmine 匹配器 matcher 属性: not: 意义:反转后连接的匹配器 type:matchers 例子: expect(something).not.toBe(true); 方法: nothing() 意义:expect 没有明确 例子: expect().nothing(); toB
阅读全文
摘要:Jasmine 属性: DEFAULT_TIMEOUT_INTERVAL: 静态(static) 等待异步 it(规范)完成的默认时间(毫秒) MAX_PRETTY_PRINT_ARRAY_LENGTH: 静态(static) 打印数组Array时,要显示的数组元素的最大数量。 限制对象Object
阅读全文
摘要:jasmine全局方法: describe: 语法:describe(description, specDefinition) 执行:创建一组 it(规范),通常称为套件,describe 可以嵌套使用,以树的形式组合展示 参数: description:string,组(套件)的文本描述 spec
阅读全文
摘要:1、异步支持 jasmine支持异步操作的测试 传给beforeEach、afterEach、beforeAll、afterAll、it 方法的函数可以是异步的。 有三种方法可以实现异步测试: 方法一:接收一个可选的回调参数 方法二:promise 方法三:通过在支持异步的环境中使用 async 关
阅读全文
摘要:1、Jasmine 之 Spies 代码示例: describe("A spy", function() { var foo, bar = null; beforeEach(function() { foo = { setBar: function(value) { bar = value; } }
阅读全文
摘要:1、套件(suites) (describe 套件):描述测试内容 代码示例: describe("A suite", function() { it("contains spec with an expectation", function() { expect(true).toBe(true);
阅读全文
摘要:angular项目部署到nginx,css样式文件加载出问题,报警:Resource interpreted as Stylesheet but transferred with MIME type text/plain 解决思路: 项目部署之前一切运行正常,部署到nginx之后出问题,可从ngin
阅读全文
摘要:首先要有一个音频文件(xxx.mp3) // js 代码 var mp3 = new Audio('xxx.mp3'); // 创建音频对象 mp3.play(); // 播放 mp3.pause(); // 暂停 mp3.load(); // 重载(重新开始)
阅读全文
摘要:动态表单 1、表单验证 在表单提交时,进行手动判断每一项的验证 submit(){ for (const i in this.validateForm.controls) { this.validateForm.controls[i].markAsDirty(); this.validateForm
阅读全文