我想在希腊文中使用这个正则表达式新的RegExp("\ b"+ pat +"\ b"),但"\ b"元字符仅支持ASCII字符.
我尝试过XregExp库,但我没有设法解决这个问题.
任何建议将不胜感激.
以下代码将在两台不同的计算机上同时失败(Windows 7,Chrome 12.0.742.100).
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test</title>
<script type="text/javascript">
location.hash = "#one";
location.hash = "#two";
location.hash = "#three";
</script>
</head>
<body>
This will error out "Uncaught Error: can't load XRegExp twice in the same frame" in chrome. Anyone got an answer?
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我觉得我尝试了一切.任何人都可以在chrome上确认这个错误,有没有人知道我如何修复它?非常感谢.
错误的URL:http: //jalsoedesign.net/test/hashchanging/
我应该补充: 它工作正常,做它应该做什么(更改页面哈希),但仍然出现错误.
我正在将大量的QUnit测试转换为Jasmine.在QUnit中,我习惯于看到所有测试模块的测试总数,显示在顶部.例如:
测试在157毫秒内完成.
528次测试528次通过,0次失败.
我认为测试的数量是重要的信息.但是,Jasmine的示例测试运行器不显示测试总数.相反,你会得到类似的东西:
通过106规格
这些规范中的每一个都可以包含任意数量的单独测试.是否可以确定已运行的测试总数,以便我可以在我的测试运行器中显示它?我在网上和Jasmine文档中查找过信息,但到目前为止还没有找到任何信息.
根据@ ggozad的回复,我提出了以下解决方案,该解决方案将打印到控制台.欢迎提出如何改进它或如何将结果干净地添加到Jasmine的HTML输出的建议.
var jasmineEnv = jasmine.getEnv();
var htmlReporter = new jasmine.HtmlReporter();
var reportRunnerResults = htmlReporter.reportRunnerResults;
htmlReporter.reportRunnerResults = function(runner) {
reportRunnerResults(runner);
var specs = runner.specs();
var specResults;
var assertionCount = {total: 0, passed: 0, failed: 0};
for (var i = 0; i < specs.length; ++i) {
if (this.specFilter(specs[i])) {
specResults = specs[i].results();
assertionCount.total += specResults.totalCount;
assertionCount.passed += specResults.passedCount;
assertionCount.failed += specResults.failedCount;
}
}
if (console && console.log) {
console.log('Total: ' + assertionCount.total);
console.log('Passed: ' …Run Code Online (Sandbox Code Playgroud)