Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
nosir committed May 19, 2020
2 parents 3fbd8b5 + deb7274 commit 0935353
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/cleave-angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {
if (pps.tailPrefix) {
value = value + pps.prefix;
} else {
} else if(value !== pps.prefix) {
value = pps.prefix + value;
}

Expand Down
4 changes: 2 additions & 2 deletions dist/cleave-esm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

var NumeralFormatter = function (numeralDecimalMark,
numeralIntegerScale,
Expand Down Expand Up @@ -1361,7 +1361,7 @@ Cleave.prototype = {
if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {
if (pps.tailPrefix) {
value = value + pps.prefix;
} else {
} else if(value !== pps.prefix) {
value = pps.prefix + value;
}

Expand Down
2 changes: 1 addition & 1 deletion dist/cleave-react-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {
if (pps.tailPrefix) {
value = value + pps.prefix;
} else {
} else if (value !== pps.prefix) {
value = pps.prefix + value;
}

Expand Down
2 changes: 1 addition & 1 deletion dist/cleave-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {
if (pps.tailPrefix) {
value = value + pps.prefix;
} else {
} else if (value !== pps.prefix) {
value = pps.prefix + value;
}

Expand Down
2 changes: 1 addition & 1 deletion dist/cleave.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {
if (pps.tailPrefix) {
value = value + pps.prefix;
} else {
} else if(value !== pps.prefix) {
value = pps.prefix + value;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Cleave.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ Cleave.prototype = {
if (pps.prefix) {
if (pps.tailPrefix) {
value = value + pps.prefix;
} else {
} else if(value !== pps.prefix) {
value = pps.prefix + value;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Cleave.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ var cleaveReactClass = CreateReactClass({
if (pps.prefix) {
if (pps.tailPrefix) {
value = value + pps.prefix;
} else {
} else if (value !== pps.prefix) {
value = pps.prefix + value;
}

Expand Down
12 changes: 12 additions & 0 deletions test/browser/custom.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
describe('Custom input field', function () {
var field = document.querySelector('.input-custom');

beforeEach(function(){ field.value = ''; });

it('should use custom blocks', function () {
var cleave = new Cleave(field, {
blocks: [3, 3, 3]
Expand Down Expand Up @@ -82,6 +84,16 @@ describe('Custom input field', function () {
assert.equal(field.value, 'UFO-123');
});

it('should use defined prefix with noImmediatePrefix enabled', function() {
var cleave = new Cleave(field, {
prefix: 'GTM-',
noImmediatePrefix: true
});

cleave.setRawValue('1001');
assert.equal(cleave.getFormattedValue(), 'GTM-1001');
});

it('should not trim prefix when rawValueTrimPrefix is not enabled', function () {
var cleave = new Cleave(field, {
prefix: '$',
Expand Down

0 comments on commit 0935353

Please sign in to comment.