我正在测试一个ember 2.13应用程序。我想检索页面标题的值,但这样做是因为测试中的document.title从测试套件页面中获取了标题。这里我可能忽略了一个简单的ember-qunit特性。有什么提示吗?
发布于 2017-08-17 11:56:07
这可能有点过头了,但您可以使用http://tim-evans.github.io/ember-page-title/。并像他们一样测试它:
// Testem appends progress to the title...
// and there's no way to stop this at the moment
function title() {
return findWithAssert('title', 'head').text().trim().replace(/^\(\d+\/\d+\)/, '');
}
test('the default configuration works', async function (assert) {
assert.expect(1);
await visit('/posts');
assert.equal(title(), 'My App | Posts');
});https://github.com/tim-evans/ember-page-title/blob/master/tests/acceptance/posts-test.js#L17-L28
https://stackoverflow.com/questions/45617146
复制相似问题