summaryrefslogtreecommitdiff
path: root/addons/barcodes/static/tests
diff options
context:
space:
mode:
Diffstat (limited to 'addons/barcodes/static/tests')
-rw-r--r--addons/barcodes/static/tests/barcode_tests.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/addons/barcodes/static/tests/barcode_tests.js b/addons/barcodes/static/tests/barcode_tests.js
index 0e2996d8608..58cf13925b7 100644
--- a/addons/barcodes/static/tests/barcode_tests.js
+++ b/addons/barcodes/static/tests/barcode_tests.js
@@ -11,7 +11,7 @@ var testUtils = require('web.test_utils');
var NotificationService = require('web.NotificationService');
var createView = testUtils.createView;
-var triggerKeypressEvent = testUtils.triggerKeypressEvent;
+var triggerKeypressEvent = testUtils.dom.triggerKeypressEvent;
QUnit.module('Barcodes', {
beforeEach: function () {
@@ -109,23 +109,23 @@ QUnit.test('edit, save and cancel buttons', function (assert) {
// O-CMD.EDIT
_.each(["O","-","C","M","D",".","E","D","I","T","Enter"], triggerKeypressEvent);
- assert.strictEqual(form.$(".o_form_editable").length, 1,
+ assert.containsOnce(form, ".o_form_editable",
"should have switched to 'edit' mode");
// dummy change to check that it actually saves
- form.$('.o_field_widget').val('test').trigger('input');
+ testUtils.fields.editInput(form.$('.o_field_widget'), 'test');
// O-CMD.SAVE
_.each(["O","-","C","M","D",".","S","A","V","E","Enter"], triggerKeypressEvent);
- assert.strictEqual(form.$(".o_form_readonly").length, 1,
+ assert.containsOnce(form, ".o_form_readonly",
"should have switched to 'readonly' mode");
assert.verifySteps(['save'], 'should have saved');
// O-CMD.EDIT
_.each(["O","-","C","M","D",".","E","D","I","T","Enter"], triggerKeypressEvent);
// dummy change to check that it correctly discards
- form.$('.o_field_widget').val('test').trigger('input');
+ testUtils.fields.editInput(form.$('.o_field_widget'), 'test');
// O-CMD.CANCEL
_.each(["O","-","C","M","D",".","D","I","S","C","A","R","D","Enter"], triggerKeypressEvent);
- assert.strictEqual(form.$(".o_form_readonly").length, 1,
+ assert.containsOnce(form, ".o_form_readonly",
"should have switched to 'readonly' mode");
assert.verifySteps(['save'], 'should not have saved');
@@ -169,7 +169,7 @@ QUnit.test('do no update form twice after a command barcode scanned', function (
var delay = barcodeEvents.BarcodeEvents.max_time_between_keys_in_ms;
barcodeEvents.BarcodeEvents.max_time_between_keys_in_ms = 0;
- testUtils.patch(FormController, {
+ testUtils.mock.patch(FormController, {
update: function () {
assert.step('update');
return this._super.apply(this, arguments);
@@ -212,7 +212,7 @@ QUnit.test('do no update form twice after a command barcode scanned', function (
form.destroy();
barcodeEvents.BarcodeEvents.max_time_between_keys_in_ms = delay;
- testUtils.unpatch(FormController);
+ testUtils.mock.unpatch(FormController);
});
QUnit.test('widget field_float_scannable', function (assert) {
@@ -250,7 +250,7 @@ QUnit.test('widget field_float_scannable', function (assert) {
assert.strictEqual(form.$('.o_field_widget[name=int_field]').text(), '4',
"should display the correct value in readonly");
- form.$buttons.find('.o_form_button_edit').click();
+ testUtils.form.clickEdit(form);
assert.strictEqual(form.$('.o_field_widget[name=int_field]').val(), '4',
"should display the correct value in edit");
@@ -387,7 +387,7 @@ QUnit.test('specification of widget barcode_handler', function (assert) {
},
});
- assert.strictEqual(form.$('.o_data_row').length, 2,
+ assert.containsN(form, '.o_data_row', 2,
"one2many should contain 2 rows");
// scan twice product 1
@@ -403,7 +403,7 @@ QUnit.test('specification of widget barcode_handler', function (assert) {
assert.strictEqual(form.$('.o_data_row:nth(1) .o_data_cell:nth(1)').text(), '1',
"quantity of line one should have been incremented");
- form.$buttons.find('.o_form_button_save').click();
+ testUtils.form.clickSave(form);
form.destroy();
barcodeEvents.BarcodeEvents.max_time_between_keys_in_ms = delay;
@@ -526,7 +526,7 @@ QUnit.test('barcode_scanned only trigger error for active view', function (asser
},
});
- form.$('.o_data_row:first').click();
+ testUtils.dom.click(form.$('.o_data_row:first'));
// We do not trigger on the body since modal and
// form view are both inside it.