- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我无法找到有关此处编写的 errorMessage()
函数的任何来源或解释:
https://angular.io/guide/testing#async-test-with-fakeasync .
你能帮我梳理一下,里面有什么吗?
最佳答案
errorMessage()
函数的代码是:
// Helper function to get the error message element value
// An *ngIf keeps it out of the DOM until there is an error
const errorMessage = () => {
const el = fixture.nativeElement.querySelector('.error');
return el ? el.textContent : null;
};
要查找此代码:
1- 从此处下载用于测试代码的示例:
https://angular.io/guide/testing#async-test-with-fakeasync
因此,在页面顶部点击下载示例
直接链接:https://angular.io/generated/zips/testing/testing.zip
2- 解压缩文件 testing.zip 并转到此目录:\testing\src\app\twain
3- 打开文件twain.component.spec
因此您会在文件顶部找到辅助函数 errorMessage()
,甚至是您在问题中给出的链接所指的测试。
关于javascript - Angular 测试文档中 "errorMessage()"功能的内容。 (见说明),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49042730/
我按照教程为我的应用程序制作了一个自定义远程验证器,这样即使禁用了 javascript,它也能正常工作。它与普通的 Remote 验证一样,具有指定的 controller 和 action 以及可
我正在使用 TFS API 2010 将几条错误消息插入到 ITestActionResult 中。如果我使用 TestRunner(添加注释)执行此操作并使用 API 读取字段 (ErrorMess
我有这个: [Range(1, 1000, ErrorMessage = "Enter a value between 1 and 1000")] public object Obje
我正在尝试与 OEM 库交互。在一台计算机上一切正常,但我在另一台计算机上遇到了很多问题。 我的代码抛出一个 COM 异常,但我无法弄清楚没有 ErrorMessage(); 的错误代码的含义 代码
我有一些代码调用 _com_object 的 ErroerMessage() 函数以在 try、catch 中返回错误代码。 catch(const _com_error& error) { m
当试图通过服务器控件创建一个冗长的 RegEx ErrorMessage 时,我认为添加背景颜色和边界来为消息提供一些“风格”会很好。 当我尝试使用边框和颜色将 CssClass 附加到服务器控件时,
任何人都知道是否可以执行以下操作: public class User { public Guid UserID { get; set; } [Required(ErrorMessag
我一直在尝试创建一个成员(member)登录页面来链接到我的网站。我的 PHP 页面中有许多嵌套的 If,但是无论我尝试什么,我都会从第一个 else 语句中收到 $errormsg。 我设法改变这一
我正在使用我以前从未使用过的 .net 构建的网站。 我有这串代码... 它输出一个文本字段,如果发生错误,则显示包含在跨度中的“ErrorMessage”文本。我需要将此错误消息跨度移动到页面的其
我不知道如何从服务访问错误消息。我正在使用 WebAPI2 和 AngularJS。 Controller : testApp.controller('ModalCtrl', ['$log', '$s
我构建了一个简单的日期检查来验证表单中的日期是否小于当前日期。 ValidationAttribute public class DateIsValidAttribute : ValidationAt
为什么我不能这样做? [Required(ErrorMessage = "*")] [RegularExpression("^[a-zA-Z0-9_]*$", ErrorMessage = Resou
我创建了一个自定义验证属性,它只验证一个CPF属性是否是一个有效的CPF,但是当我本地化应用程序时,我注意到我的自定义属性没有将其消息由框架本地化,这与数据属性 Required 不同,它的消息已正确
在 ASP.NET MVC 4 应用程序中,LocalPasswordModel 类(在 Models\AccountModels.cs 中)如下所示: public class LocalPassw
考虑下面这段代码: 有没有办法在 ErrorMessage 字符串中插入某种转义字符,以确保请重试。使用这种格式! ELRLDKX##Z 在另一条线上?我试过了,\n 运气不好。 最佳答案 Val
我想创建一个包含另一个变量或属性值的 ErrorMessage。我想保持简单。到目前为止,这段代码显示了 String.Format 参数的错误。实现它的最佳方法是什么: public cla
我无法找到有关此处编写的 errorMessage() 函数的任何来源或解释: https://angular.io/guide/testing#async-test-with-fakeasync .
我有这样的东西: [DisplayName("First Name")] [Required(ErrorMessage="{0} is required.")] [String
使用 Python,我按照它进行了测试,弹出了以下错误: { "errorMessage": "module initialization error" } 我做错了什么? from __futu
这是我在使用 MVC2 时遇到的错误: Either ErrorMessageString or ErrorMessageResourceName must be set, but not both.
我是一名优秀的程序员,十分优秀!