Added variable button fix
This commit is contained in:
parent
18e2388de1
commit
99918be731
|
@ -31,23 +31,27 @@ class CommentTypeToggle {
|
|||
}],
|
||||
};
|
||||
|
||||
if (!this.closeButton || !this.reopenButton) return config;
|
||||
if (this.closeButton) {
|
||||
config.InputSetter.push({
|
||||
input: this.closeButton,
|
||||
valueAttribute: 'data-close-text',
|
||||
}, {
|
||||
input: this.closeButton,
|
||||
valueAttribute: 'data-close-text',
|
||||
inputAttribute: 'data-alternative-text',
|
||||
});
|
||||
}
|
||||
|
||||
config.InputSetter.push({
|
||||
input: this.closeButton,
|
||||
valueAttribute: 'data-close-text',
|
||||
}, {
|
||||
input: this.closeButton,
|
||||
valueAttribute: 'data-close-text',
|
||||
inputAttribute: 'data-alternative-text',
|
||||
}, {
|
||||
input: this.reopenButton,
|
||||
valueAttribute: 'data-reopen-text',
|
||||
}, {
|
||||
input: this.reopenButton,
|
||||
valueAttribute: 'data-reopen-text',
|
||||
inputAttribute: 'data-alternative-text',
|
||||
});
|
||||
if (this.reopenButton) {
|
||||
config.InputSetter.push({
|
||||
input: this.reopenButton,
|
||||
valueAttribute: 'data-reopen-text',
|
||||
}, {
|
||||
input: this.reopenButton,
|
||||
valueAttribute: 'data-reopen-text',
|
||||
inputAttribute: 'data-alternative-text',
|
||||
});
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ require('./task_list');
|
|||
const noteTypeInput = form.querySelector('#note_type');
|
||||
const submitButton = form.querySelector('.js-comment-type-dropdown .js-comment-submit-button');
|
||||
const closeButton = form.querySelector('.js-note-target-close');
|
||||
const reopenButton = form.querySelector('.js-note-target-reopen');
|
||||
const reopenButton = form.querySelector('.reopen-mr-link') || form.querySelector('.js-note-target-reopen');
|
||||
|
||||
const commentTypeToggle = new CommentTypeToggle({
|
||||
dropdownTrigger,
|
||||
|
|
|
@ -101,7 +101,7 @@ describe('CommentTypeToggle', function () {
|
|||
this.setConfig = CommentTypeToggle.prototype.setConfig.call(this.commentTypeToggle);
|
||||
});
|
||||
|
||||
it('should not add .closeButton or .reopenButton related InputSetter config', function () {
|
||||
it('should not add .closeButton related InputSetter config', function () {
|
||||
expect(this.setConfig).toEqual({
|
||||
InputSetter: [{
|
||||
input: this.commentTypeToggle.noteTypeInput,
|
||||
|
@ -109,6 +109,13 @@ describe('CommentTypeToggle', function () {
|
|||
}, {
|
||||
input: this.commentTypeToggle.submitButton,
|
||||
valueAttribute: 'data-submit-text',
|
||||
}, {
|
||||
input: this.commentTypeToggle.reopenButton,
|
||||
valueAttribute: 'data-reopen-text',
|
||||
}, {
|
||||
input: this.commentTypeToggle.reopenButton,
|
||||
valueAttribute: 'data-reopen-text',
|
||||
inputAttribute: 'data-alternative-text',
|
||||
}],
|
||||
});
|
||||
});
|
||||
|
@ -127,7 +134,7 @@ describe('CommentTypeToggle', function () {
|
|||
this.setConfig = CommentTypeToggle.prototype.setConfig.call(this.commentTypeToggle);
|
||||
});
|
||||
|
||||
it('should not add .closeButton or .reopenButton related InputSetter config', function () {
|
||||
it('should not add .reopenButton related InputSetter config', function () {
|
||||
expect(this.setConfig).toEqual({
|
||||
InputSetter: [{
|
||||
input: this.commentTypeToggle.noteTypeInput,
|
||||
|
@ -135,6 +142,13 @@ describe('CommentTypeToggle', function () {
|
|||
}, {
|
||||
input: this.commentTypeToggle.submitButton,
|
||||
valueAttribute: 'data-submit-text',
|
||||
}, {
|
||||
input: this.commentTypeToggle.closeButton,
|
||||
valueAttribute: 'data-close-text',
|
||||
}, {
|
||||
input: this.commentTypeToggle.closeButton,
|
||||
valueAttribute: 'data-close-text',
|
||||
inputAttribute: 'data-alternative-text',
|
||||
}],
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue