[IMP] web: test_utils: catch iframe src

Trigger an RPC with the corresponding route so that the arguments
specified into the route can be tested.
This commit is contained in:
Aaron Bohy
2017-04-11 19:44:38 +02:00
parent 825cd69dc0
commit 7c04deef5e
+5 -5
View File
@@ -132,9 +132,9 @@ function createAsyncView(params) {
var view = new params.View(fields_view.arch, fields_view.fields, viewOptions);
// remove src attribute on images to remove not found error in tests
function removeImageSrc () {
$('img', this).each(function () {
// remove src attribute on images and iframes to remove not found error in tests
function removeSrcAttribute () {
$('img, iframe[src]', this).each(function () {
var src = $(this).attr('src');
if (src[0] !== '#') {
$(this).attr('src', '#test:' + $(this).attr('src'));
@@ -142,7 +142,7 @@ function createAsyncView(params) {
}
});
}
$('#qunit-fixture').on('DOMNodeInserted', removeImageSrc);
$('#qunit-fixture').on('DOMNodeInserted', removeSrcAttribute);
if (params.with_modifiers) {
_.each(params.with_modifiers, function (modifier, name) {
@@ -170,7 +170,7 @@ function createAsyncView(params) {
// when it will be called the second time (by its parent)
delete view.destroy;
widget.destroy();
$('#qunit-fixture').off('DOMNodeInserted', removeImageSrc);
$('#qunit-fixture').off('DOMNodeInserted', removeSrcAttribute);
};
return view.appendTo($view_manager).then(function () {
view.$el.on('click', 'a', function (ev) {