Skip to content

Commit

Permalink
work for #8133 Setting style.textAlign is hard coded for numeric and …
Browse files Browse the repository at this point in the history
…currency mask
  • Loading branch information
OlgaLarina committed Apr 18, 2024
1 parent a6778cc commit 9fabbf7
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions tests/mask/mask_settings_tests.ts
Expand Up @@ -176,17 +176,6 @@ QUnit.test("Currency mask: value & inputValue", function (assert) {
assert.equal(q.inputValue, "$ 123,456", "masked inputValue #4");
});

QUnit.test("Numeric mask: text aligment", function (assert) {
const q = new QuestionTextModel("q1");
assert.deepEqual(q.inputStyle, { width: undefined });

q.maskType = "numeric";
assert.deepEqual(q.inputStyle, { width: undefined, textAlign: "right" });

q.inputTextAlignment = "left";
assert.deepEqual(q.inputStyle, { width: undefined, textAlign: "left" });
});

QUnit.test("Currency mask: text aligment", function (assert) {
const q = new QuestionTextModel("q1");
assert.deepEqual(q.inputStyle, { width: undefined });
Expand All @@ -204,21 +193,33 @@ class IntegerMask extends InputMaskNumeric {
}
}

QUnit.test("Currency mask: text aligment", function (assert) {
QUnit.test("isNumeric", function (assert) {
Serializer.addClass("integermask", [],
() => new IntegerMask(),
"numericmask"
);

const q = new QuestionTextModel("q1");
assert.deepEqual(q.inputStyle, { width: undefined });
assert.equal(q.maskType, "none");
assert.equal(q.maskSettings.isNumeric, false);

q.maskType = "integer";
assert.equal(q.maskSettings instanceof IntegerMask, true);
assert.deepEqual(q.inputStyle, { width: undefined, textAlign: "right" });
q.maskType = "pattern";
assert.equal(q.maskSettings.isNumeric, false);

q.inputTextAlignment = "left";
assert.deepEqual(q.inputStyle, { width: undefined, textAlign: "left" });
q.maskType = "numeric";
assert.equal(q.maskSettings.isNumeric, true);

q.maskType = "datetime";
assert.equal(q.maskSettings.isNumeric, false);

q.maskType = "currency";
assert.equal(q.maskSettings.isNumeric, true);

q.maskType = "none";
assert.equal(q.maskSettings.isNumeric, false);

q.maskType = "integer";
assert.equal(q.maskSettings.isNumeric, true);

Serializer.removeClass("integermask");
});

0 comments on commit 9fabbf7

Please sign in to comment.