Skip to content

Commit

Permalink
add console logs for troubleshooting
Browse files Browse the repository at this point in the history
  • Loading branch information
jplukarski committed Jan 17, 2025
1 parent 8268d16 commit af75cd9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/lib/formatter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class PatternFormatter {
}

unformat(options: FormatMetadata): FormatMetadata {
console.log("Unformatting: ", options.value);

Check warning on line 77 in src/lib/formatter/index.ts

View workflow job for this annotation

GitHub Actions / Unit Tests on Ubuntu

Unexpected console statement
let start = options.selection.start;
let end = options.selection.end;
let unformattedString = "";
Expand All @@ -100,7 +101,7 @@ export class PatternFormatter {
end--;
}
}

console.log("Unformatted String", unformattedString);

Check warning on line 104 in src/lib/formatter/index.ts

View workflow job for this annotation

GitHub Actions / Unit Tests on Ubuntu

Unexpected console statement
return {
selection: {
start: start,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/strategies/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class BaseStrategy extends StrategyInterface {

getUnformattedValue(forceUnformat?: boolean): string {
let value = this.inputElement.value;

console.log("Raw value: ", value);

Check warning on line 48 in src/lib/strategies/base.ts

View workflow job for this annotation

GitHub Actions / Unit Tests on Ubuntu

Unexpected console statement
if (forceUnformat || this.isFormatted) {
value = this.formatter.unformat({
value: this.inputElement.value,
Expand Down
11 changes: 10 additions & 1 deletion src/lib/strategies/ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ export class IosStrategy extends BaseStrategy {
this.formatListener();

if (!isCustomEvent) {
console.log("About to fix leading blank space on ios");

Check warning on line 29 in src/lib/strategies/ios.ts

View workflow job for this annotation

GitHub Actions / Unit Tests on Ubuntu

Unexpected console statement
this.fixLeadingBlankSpaceOnIos();
}
});
this.inputElement.addEventListener("focus", () => {
console.log("Focus event on input");

Check warning on line 34 in src/lib/strategies/ios.ts

View workflow job for this annotation

GitHub Actions / Unit Tests on Ubuntu

Unexpected console statement
this.formatListener();
});
this.inputElement.addEventListener("paste", (event) => {
Expand All @@ -41,20 +43,27 @@ export class IosStrategy extends BaseStrategy {
// is positioned as if there is a blank space when there
// is not, setting it to '' in a setTimeout fixes it ¯\_(ツ)_/¯
private fixLeadingBlankSpaceOnIos(): void {
console.log("fixing leading blank space");

Check warning on line 46 in src/lib/strategies/ios.ts

View workflow job for this annotation

GitHub Actions / Unit Tests on Ubuntu

Unexpected console statement
const input = this.inputElement;

if (input.value === "") {
console.log("input is empty, fixing the blank space");

Check warning on line 50 in src/lib/strategies/ios.ts

View workflow job for this annotation

GitHub Actions / Unit Tests on Ubuntu

Unexpected console statement
setTimeout(function () {
input.value = "";
}, 0);
} else {
console.log("Not the last digit being erased, not fixing blank space");

Check warning on line 55 in src/lib/strategies/ios.ts

View workflow job for this annotation

GitHub Actions / Unit Tests on Ubuntu

Unexpected console statement
}
}

private formatListener(): void {
console.log("Formatting the listener");

Check warning on line 60 in src/lib/strategies/ios.ts

View workflow job for this annotation

GitHub Actions / Unit Tests on Ubuntu

Unexpected console statement
const input = this.inputElement;
const stateToFormat = this.getStateToFormat();
const formattedState = this.formatter.format(stateToFormat);

console.log("Input to format: ", input);
console.log("State to Format", stateToFormat);
console.log("Formatted State: ", formattedState);
input.value = formattedState.value;
setSelection(
input,
Expand Down

0 comments on commit af75cd9

Please sign in to comment.