-
Notifications
You must be signed in to change notification settings - Fork 363
#149 Be able to evaluate page with iframes #150
Changes from all commits
88731e1
2fbd434
08b3be1
dc66bb7
715c1e6
83e5af1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,16 @@ | |
equal(matched.length, DIV_COUNT); | ||
}); | ||
|
||
test("Iframe with simple DOM", function () { | ||
var ifrm = document.createElement("IFRAME"); | ||
var container = document.getElementById('qunit-fixture'); | ||
container.appendChild(ifrm); | ||
ifrm.contentDocument.body.appendChild(buildTestDom()); | ||
var matched = []; | ||
axs.AuditRule.collectMatchingElements(container, matcher, matched); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this method mutating There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was justing copying the same behavior in others tests (in this same file). I don't like methods changing parameter's content too (bad smell). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, that's fine, thought I'd point it out as something we can improve in the future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intended behaviour. Since this is a recursive method, we need an accumulator to keep track of matched elements - otherwise we'd be constantly having to combine partial results. |
||
equal(matched.length, DIV_COUNT); | ||
}); | ||
|
||
test("With shadow DOM with no content insertion point", function () { | ||
var container = document.getElementById('qunit-fixture'); | ||
container.appendChild(buildTestDom()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
opt_shadowRoot
necessary here? Is it required forcollectMatchingElements
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, it's a recursive method and I think it's necessary to always pass this atribute forward. For example, if we got a shadow down inside a iframe contentDocument, it will be needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.