summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/core
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/tests/core')
-rw-r--r--addons/web/static/tests/core/dom_tests.js9
-rw-r--r--addons/web/static/tests/core/mixins_tests.js2
-rw-r--r--addons/web/static/tests/core/widget_tests.js16
3 files changed, 14 insertions, 13 deletions
diff --git a/addons/web/static/tests/core/dom_tests.js b/addons/web/static/tests/core/dom_tests.js
index 08966cd484a..ab10bbb78f8 100644
--- a/addons/web/static/tests/core/dom_tests.js
+++ b/addons/web/static/tests/core/dom_tests.js
@@ -2,6 +2,7 @@ odoo.define('web.dom_tests', function (require) {
"use strict";
var dom = require('web.dom');
+var testUtils = require('web.test_utils');
/**
* Create an autoresize text area with 'border-box' as box sizing rule.
@@ -43,7 +44,7 @@ QUnit.module('dom', {}, function () {
$fixedTextarea[0].scrollHeight + 'px',
"autoresized textarea should have height of fixed textarea + padding (0 line)");
- $textarea.val('a\nb\nc\nd').trigger('input');
+ testUtils.fields.editInput($textarea, 'a\nb\nc\nd');
assert.strictEqual($textarea.css('height'),
$fixedTextarea[0].scrollHeight + 'px',
"autoresized textarea should have height of fixed textarea + padding (4 lines)");
@@ -63,7 +64,7 @@ QUnit.module('dom', {}, function () {
expectedTextAreaHeight + 'px',
"autoresized textarea should have height of fixed textarea + padding (0 line)");
- $textarea.val('a\nb\nc\nd').trigger('input');
+ testUtils.fields.editInput($textarea, 'a\nb\nc\nd');
// twice the padding of 10px
expectedTextAreaHeight = $fixedTextarea[0].scrollHeight + 2*10;
assert.strictEqual($textarea.css('height'),
@@ -88,7 +89,7 @@ QUnit.module('dom', {}, function () {
expectedTextAreaHeight + 'px',
"autoresized textarea should have height of fixed textarea + border (0 line)");
- $textarea.val('a\nb\nc\nd').trigger('input');
+ testUtils.fields.editInput($textarea, 'a\nb\nc\nd');
// top (2px) + bottom (3px) borders
expectedTextAreaHeight = $fixedTextarea[0].scrollHeight + (2 + 3);
assert.strictEqual($textarea.css('height'),
@@ -114,7 +115,7 @@ QUnit.module('dom', {}, function () {
expectedTextAreaHeight + 'px',
"autoresized textarea should have height of fixed textarea + border (0 line)");
- $textarea.val('a\nb\nc\nd').trigger('input');
+ testUtils.fields.editInput($textarea, 'a\nb\nc\nd');
// twice padding (10px) + top (2px) + bottom (3px) borders
expectedTextAreaHeight = $fixedTextarea[0].scrollHeight + (2*10 + 2 + 3);
assert.strictEqual($textarea.css('height'),
diff --git a/addons/web/static/tests/core/mixins_tests.js b/addons/web/static/tests/core/mixins_tests.js
index c49c33ec648..27c87870876 100644
--- a/addons/web/static/tests/core/mixins_tests.js
+++ b/addons/web/static/tests/core/mixins_tests.js
@@ -13,7 +13,7 @@ QUnit.module('core', {}, function () {
var widget = new Widget();
- testUtils.intercept(widget, 'do_action', function (event) {
+ testUtils.mock.intercept(widget, 'do_action', function (event) {
assert.strictEqual(event.data.action, 'test.some_action_id',
"should have sent proper action name");
assert.deepEqual(event.data.options, {clear_breadcrumbs: true},
diff --git a/addons/web/static/tests/core/widget_tests.js b/addons/web/static/tests/core/widget_tests.js
index f61d4a18f9b..834033a1769 100644
--- a/addons/web/static/tests/core/widget_tests.js
+++ b/addons/web/static/tests/core/widget_tests.js
@@ -122,7 +122,7 @@ QUnit.module('core', {}, function () {
widget.renderElement();
assert.strictEqual(widget.el.attributes.length, 1, "should have one attribute");
- assert.strictEqual(widget.$el.attr('id'), 'foo', "should have generated the id attribute");
+ assert.hasAttrValue(widget.$el, 'id', 'foo', "should have generated the id attribute");
assert.strictEqual(widget.el.id, 'foo', "should also be available via property");
});
@@ -135,7 +135,7 @@ QUnit.module('core', {}, function () {
widget.renderElement();
assert.strictEqual(widget.el.className, 'oe_some_class', "should have the right property");
- assert.strictEqual(widget.$el.attr('class'), 'oe_some_class', "should have the right attribute");
+ assert.hasAttrValue(widget.$el, 'class', 'oe_some_class', "should have the right attribute");
});
QUnit.test('no template, bunch of attributes', function (assert) {
@@ -156,16 +156,16 @@ QUnit.module('core', {}, function () {
assert.strictEqual(widget.el.attributes.length, 5, "should have all the specified attributes");
assert.strictEqual(widget.el.id, 'some_id');
- assert.strictEqual(widget.$el.attr('id'), 'some_id');
+ assert.hasAttrValue(widget.$el, 'id', 'some_id');
assert.strictEqual(widget.el.className, 'some_class');
- assert.strictEqual(widget.$el.attr('class'), 'some_class');
+ assert.hasAttrValue(widget.$el, 'class', 'some_class');
- assert.strictEqual(widget.$el.attr('data-foo'), 'data attribute');
+ assert.hasAttrValue(widget.$el, 'data-foo', 'data attribute');
assert.strictEqual(widget.$el.data('foo'), 'data attribute');
- assert.strictEqual(widget.$el.attr('clark'), 'gable');
- assert.strictEqual(widget.$el.attr('spoiler'), 'snape kills dumbledore');
+ assert.hasAttrValue(widget.$el, 'clark', 'gable');
+ assert.hasAttrValue(widget.$el, 'spoiler', 'snape kills dumbledore');
});
QUnit.test('template', function (assert) {
@@ -383,7 +383,7 @@ QUnit.module('core', {}, function () {
var def;
var parent = new Widget();
- testUtils.addMockEnvironment(parent, {
+ testUtils.mock.addMockEnvironment(parent, {
session: {
rpc: function () {
def = $.Deferred();