Skip to content

Commit

Permalink
fix(igNumericEditor): check allowNullValue = false #1834
Browse files Browse the repository at this point in the history
  • Loading branch information
Lipata committed Nov 8, 2018
1 parent ff50fc5 commit 5065f24
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/js/modules/infragistics.ui.editors.js
Original file line number Diff line number Diff line change
Expand Up @@ -4674,8 +4674,9 @@
}
},
_getValueBetweenMinMax: function(value) {

// N.A. 7 November 2018, Bug #1834, Initial value that is null, should not be overwritten by the min/max values.
if (value !== this.options.nullValue) {
if (!(this.options.allowNullValue && value === this.options.nullValue)) {
// D.P. 6th Mar 2017 #777 'minValue/maxValue options are not respected at initialization'
if (!isNaN(this.options.minValue) && this.options.minValue > value) {
value = this.options.minValue;
Expand Down
15 changes: 14 additions & 1 deletion tests/unit/editors/numericEditor/numericEditor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2815,7 +2815,7 @@ QUnit.test('IME input numbers', function (assert) {
}); // IME input numbers

QUnit.test('Numeric Editor Allow null value should take precedence over min/max values', function (assert) {
assert.expect(10);
assert.expect(12);

var $editor = this.util.appendToFixture(this.inputTag).igNumericEditor({
dataMode: "int",
Expand All @@ -2841,6 +2841,19 @@ QUnit.test('Numeric Editor Allow null value should take precedence over min/max
assert.equal($editor.igNumericEditor("displayValue"), "5", "The displayed value is not correct.");
$editor.igNumericEditor("destroy");

var $editor = this.util.appendToFixture(this.inputTag).igNumericEditor({
dataMode: "int",
allowNullValue : false,
maxValue: 100,
minValue: 5,
value: null,
width: 190
});

assert.equal($editor.igNumericEditor("value"), 5, "The value is not correct.");
assert.equal($editor.igNumericEditor("displayValue"), "5", "The displayed value is not correct.");
$editor.igNumericEditor("destroy");

$editor = this.util.appendToFixture(this.inputTag).igNumericEditor({
allowNullValue: true,
maxValue: 24,
Expand Down

0 comments on commit 5065f24

Please sign in to comment.