Skip to content

Commit

Permalink
Fixes #598 The unformatOnHover config value isn't used when set to …
Browse files Browse the repository at this point in the history
…`false`

Signed-off-by: Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>
  • Loading branch information
AlexandreBonneau committed Sep 24, 2018
1 parent a50caa9 commit 3860e20
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,8 @@
## Changelog for autoNumeric

### 4.4.3
+ Fixes #598 The `unformatOnHover` config value isn't used when set to `false`

### 4.4.2
+ Fixes #609 Uncaught Error: Cannot find module 'autonumeric' on v4.4.1
+ Reverts the changes from `4.4.1` : "Modify the `package.json` configuration `main` field to `browser`"
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "autonumeric",
"version": "4.4.2",
"version": "4.4.3",
"description": "autoNumeric is a standalone Javascript library that provides live *as-you-type* formatting for international numbers and currencies. It supports most international numeric formats and currencies including those used in Europe, Asia, and North and South America.",
"main": "dist/autoNumeric.js",
"module": "src/main.js",
Expand Down
10 changes: 6 additions & 4 deletions src/AutoNumeric.js
@@ -1,8 +1,8 @@
/**
* AutoNumeric.js
*
* @version 4.4.2
* @date 2018-09-14 UTC 18:45
* @version 4.4.3
* @date 2018-09-24 UTC 07:26
*
* @authors Bob Knothe, Alexandre Bonneau
* @contributors Sokolov Yura and others, cf. AUTHORS
Expand Down Expand Up @@ -902,7 +902,7 @@ export default class AutoNumeric {
* @returns {string}
*/
static version() {
return '4.4.2';
return '4.4.3';
}

/**
Expand Down Expand Up @@ -7331,7 +7331,9 @@ To solve that, you'd need to either set \`decimalPlacesRawValue\` to \`null\`, o
const hoveredElement = AutoNumericHelper.getHoveredElement();
if (AutoNumeric.isManagedByAutoNumeric(hoveredElement)) {
const anElement = AutoNumeric.getAutoNumericElement(hoveredElement);
this.constructor._unformatAltHovered(anElement);
if (anElement.settings.unformatOnHover) {
this.constructor._unformatAltHovered(anElement);
}
}
}
}
Expand Down
18 changes: 14 additions & 4 deletions test/e2e/index.html
Expand Up @@ -1025,6 +1025,13 @@ <h5 id="tag_h5">12345.67</h5>
</div>
</div>
</div>

<div class="testSuite">
<div class="test">
<p class="description">Issue #598</p>
<input id="issue_598" type="text" placeholder="#598">
</div>
</div>
</div>
<script>
//-------------- Classic input
Expand Down Expand Up @@ -1466,14 +1473,14 @@ <h5 id="tag_h5">12345.67</h5>

//-------------- decimalPlacesShownOnFocus and selections
new AutoNumeric('#selection1')
.french()
.set(12266.1234567, { minimumValue: '0', maximumValue: '9999999', decimalPlaces: 3, decimalPlacesShownOnFocus: 6 });
.french()
.set(12266.1234567, { minimumValue: '0', maximumValue: '9999999', decimalPlaces: 3, decimalPlacesShownOnFocus: 6 });

//-------------- showOnlyNumbersOnFocus option
new AutoNumeric('#showOnlyNumbersOnFocus1').french()
.set(-246813.58, { showOnlyNumbersOnFocus: AutoNumeric.options.showOnlyNumbersOnFocus.onlyNumbers, suffixText: ' loan' });
.set(-246813.58, { showOnlyNumbersOnFocus: AutoNumeric.options.showOnlyNumbersOnFocus.onlyNumbers, suffixText: ' loan' });
new AutoNumeric('#showOnlyNumbersOnFocus2').northAmerican()
.set(-246813.58, { showOnlyNumbersOnFocus: AutoNumeric.options.showOnlyNumbersOnFocus.onlyNumbers, suffixText: ' interest' });
.set(-246813.58, { showOnlyNumbersOnFocus: AutoNumeric.options.showOnlyNumbersOnFocus.onlyNumbers, suffixText: ' interest' });

//-------------- selectOnFocus option
new AutoNumeric('#selectOnFocusA').french().set(-246813.58, { selectOnFocus: AutoNumeric.options.selectOnFocus.select });
Expand Down Expand Up @@ -2176,6 +2183,9 @@ <h5 id="tag_h5">12345.67</h5>
//-------------- Issue #594
new AutoNumeric('#issue_594_left').french();
new AutoNumeric('#issue_594_right', ['French', { negativePositiveSignPlacement: AutoNumeric.options.negativePositiveSignPlacement.right }]);

//-------------- Issue #598
new AutoNumeric('#issue_598', 1234567.89, { unformatOnHover: false });
</script>
</body>
</html>

0 comments on commit 3860e20

Please sign in to comment.