Skip to content

Commit

Permalink
Merge branch 'master' into dkamburov/fix-1982-19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
damyanpetev authored Sep 12, 2019
2 parents f032562 + 80b0c63 commit 776f881
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/js/modules/infragistics.ui.dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -1516,18 +1516,18 @@

//V.S. 21 February, 2018 - #1204 animation chaining was not always calling moveToTop properly
if (typeof anim === "string") {
self.moveToTop(true);
elem.hide().show(anim, function () {
self._trigger("animationEnded", e, arg);
self.moveToTop(true);
});
} else {
if (typeof anim !== "object") {
anim = { easing: anim };
}
anim.complete = function () {
self._trigger("animationEnded", e, arg);
self.moveToTop(true);
};
self.moveToTop(true);
elem.hide(0).show(anim);
}
} else {
Expand Down
19 changes: 18 additions & 1 deletion src/js/modules/infragistics.ui.editors.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,13 @@
},
_setupValidator: function () {
if (this.element.igValidator) {
this._validator = this.element.igValidator(this.options.validatorOptions).data("igValidator");
// MV 9th Sep 2019 Bug #1901 Update validator language and locale correctly
var validatorOptions = $.extend(
{},
{ language: this.options.language, locale: this.options.locale },
this.options.validatorOptions
);
this._validator = this.element.igValidator(validatorOptions).data("igValidator");
this._validator.owner = this;
}
},
Expand Down Expand Up @@ -1831,6 +1837,14 @@
notifier.notify(notifier.options.state, message);
}
},

// MV 9th Sep 2019 Bug #1901 Update validator's language and locale correctly
_changeLocaleForValidator: function () {
if (this._validator) {
this._validator.options.locale = this.options.locale;
this._validator.options.language = this.options.language;
}
},
changeLocale: function () {
/* changes the all locales into the widget element to the language specified in [options.language](ui.igtexteditor#options:language)
Note that this method is for rare scenarios, see [language](ui.igtexteditor#options:language) or [locale](ui.igtexteditor#options:locale) option setter
Expand All @@ -1840,6 +1854,9 @@
*/
this._superApply(arguments);
this._changeLocaleForNotifier();

// MV 9th Sep 2019 Bug #1901 Update validator's language and locale correctly
this._changeLocaleForValidator();
},
_setOption: function (option, value) { // igTextEditor
/* igTextEditor custom setOption goes here */
Expand Down
16 changes: 7 additions & 9 deletions tests/unit/dialog/dialog-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,11 +724,11 @@ QUnit.test("[ID20] Modal Open and Close animations, passed as objects, should fi
});
});

QUnit.test("[ID21] Modal openAnimation should display modal overlay on end", function (assert) {
assert.expect(1);
QUnit.test("[ID21] Modal openAnimation should display modal overlay on start", function (assert) {
assert.expect(2);
var $dialog = this.util.appendToFixture("<div id='openAnimationDialog'><h1>Hello World!</h1></div>")
.igDialog({
state: 'open',
state: 'closed',
modal: true,
height: '400px',
width: '600px',
Expand All @@ -739,12 +739,10 @@ QUnit.test("[ID21] Modal openAnimation should display modal overlay on end", fun
return true;
}
});
var done = assert.async();
this.util.wait(320).then(function () {
var backgroundIndex = parseInt($dialog.data("igDialog")._modalDiv.css("zIndex"));
assert.ok(backgroundIndex > 0, "z-Index of overlay is not greater than 1");
done();
});
assert.notOk($dialog.data('igDialog')._modalDiv);
$dialog.igDialog('open');
var backgroundIndex = parseInt($dialog.data("igDialog")._modalDiv.css("zIndex"));
assert.ok(backgroundIndex > 0, "z-Index of overlay is not greater than 1");
});

QUnit.test("[ID22] Stacking two dialogs within eachother should not create scrollbars", function (assert) {
Expand Down
42 changes: 42 additions & 0 deletions tests/unit/editors/baseEditor/base-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,3 +503,45 @@ QUnit.test('Destroy method reverts input state.', function (assert) {
//check the value attribute and see if it is restored
assert.equal(document.getElementById(textEditorId).getAttribute("value"), "myInputValue", 'Input value attr is not the same as before Editor init');
});

QUnit.test('Set editor`s validator language', function (assert) {
assert.expect(6);
var $textEditorNoLocale = this.util.appendToFixture(this.inputTag);
$textEditorNoLocale.igTextEditor(
{
validatorOptions : {
required: true
}
});

assert.equal($textEditorNoLocale.igValidator("option", "locale"), undefined, "Validator's locale should be undefined when editor has no locale");
assert.equal($textEditorNoLocale.igValidator("option", "language").language, undefined, "Validator's language should be undefined when editor has no language");

var $textEditorWithLocale = this.util.appendToFixture(this.inputTag);
$textEditorWithLocale.igTextEditor(
{
language: "fr",
locale: "bg",
validatorOptions : {
required: true
}
});

assert.equal($textEditorWithLocale.igValidator("option", "locale"), "bg", "Validator's locale should be 'bg' when editor has locale");
assert.equal($textEditorWithLocale.igValidator("option", "language"), "fr", "Validator's language should be 'fr when editor has language");

var $textEditorValidatorWithLocale = this.util.appendToFixture(this.inputTag);
$textEditorValidatorWithLocale.igTextEditor(
{
language: "fr",
locale: "bg",
validatorOptions : {
language: "es",
locale: "jp",
required: true
}
});

assert.equal($textEditorValidatorWithLocale.igValidator("option", "locale"), "jp", "Validator's language should be 'fr when validator has language");
assert.equal($textEditorValidatorWithLocale.igValidator("option", "language"), "es", "Validator's locale should be 'es' when validator has locale");
});
3 changes: 3 additions & 0 deletions tests/unit/editors/baseEditor/tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<link type="text/css" href="../../../../src/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
<link type="text/css" href="../../../../src/css/structure/modules/infragistics.ui.popover.css" rel="stylesheet" />
<link type="text/css" href="../../../../src/css/structure/modules/infragistics.ui.notifier.css" rel="stylesheet" />
<link type="text/css" href="../../../../src/css/structure/modules/infragistics.ui.validator.css" rel="stylesheet" />
<link type="text/css" href="../../../../src/css/structure/modules/infragistics.ui.editors.css" rel="stylesheet" />


Expand All @@ -18,13 +19,15 @@
<script type="text/javascript" src="../../../../src/js/modules/i18n/infragistics.ui.popover-en.js"></script>
<script type="text/javascript" src="../../../../src/js/modules/i18n/infragistics.ui.notifier-en.js"></script>
<script type="text/javascript" src="../../../../src/js/modules/i18n/infragistics.ui.editors-en.js"></script>
<script type="text/javascript" src="../../../../src/js/modules/i18n/infragistics.ui.validator-en.js"></script>

<script type="text/javascript" src="../../../../src/js/modules/infragistics.util.js"></script>
<script type="text/javascript" src="../../../../src/js/modules/infragistics.util.jquery.js"></script>
<script type="text/javascript" src="../../../../src/js/modules/infragistics.ui.widget.js"></script>
<script type="text/javascript" src="../../../../src/js/modules/infragistics.ui.popover.js"></script>
<script type="text/javascript" src="../../../../src/js/modules/infragistics.ui.notifier.js"></script>
<script type="text/javascript" src="../../../../src/js/modules/infragistics.ui.editors.js"></script>
<script type="text/javascript" src="../../../../src/js/modules/infragistics.ui.validator.js"></script>

<script type="text/javascript" src="../../common/test-util.js"></script>

Expand Down

0 comments on commit 776f881

Please sign in to comment.