@osimatic/helpers-js 1.5.9 → 1.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/form_helper.js CHANGED
@@ -384,7 +384,9 @@ class FormHelper {
384
384
  button.classList.add('disabled');
385
385
  }
386
386
  if (action === 'stop' || action === 'reset') {
387
- button.innerHTML = button.dataset.btnText;
387
+ if (button.dataset.btnText !== undefined) {
388
+ button.innerHTML = button.dataset.btnText;
389
+ }
388
390
  button.classList.remove('disabled');
389
391
  button.disabled = false;
390
392
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.5.9",
3
+ "version": "1.5.10",
4
4
  "main": "main.js",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -687,6 +687,15 @@ describe('FormHelper', () => {
687
687
 
688
688
  expect(result).toBe(btn);
689
689
  });
690
+
691
+ test('should not overwrite innerHTML with "undefined" when reset called before loading', () => {
692
+ const form = setupForm();
693
+ const btn = addButton(form, 'validate', 'Submit');
694
+
695
+ FormHelper.buttonLoader(btn, 'reset');
696
+
697
+ expect(btn.innerHTML).toBe('Submit');
698
+ });
690
699
  });
691
700
 
692
701
  describe('getInputValue', () => {