Skip to content
Merged

Dev #2734

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export class ApplicationsListPage extends ApplicationsPage {
const titles: string[] = Cypress.$($els)
.toArray()
.map((el: HTMLElement) =>
(el.textContent || "").replace(/\s+/g, " ").trim(),
(el.textContent || "").replaceAll(/\s+/g, " ").trim(),
)
.filter((t: string) => t.length > 0);
return titles;
Expand Down
4 changes: 2 additions & 2 deletions applications/Unity.AutoUI/cypress/pages/ListPages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ export class ApplicationsPage extends ListPage {
.find(`td:nth-child(${this.columns.requestedAmount + 1})`)
.text()
.trim();
const amount = Number.parseFloat(amountText.replace(/[$,]/g, ""));
if (!isNaN(amount)) {
const amount = Number.parseFloat(amountText.replaceAll(/[$,]/g, ""));
if (!Number.isNaN(amount)) {
total += amount;
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ const APPLICATIONS_PATH = "GrantApplications";
// Skip gracefully if the supplier has no site data in this environment
cy.get("body").then(($body) => {
const rows = $body.find("#SiteInfoTable tbody tr");
const firstRowText = rows.first().text().replace(/\s+/g, " ").trim();
const firstRowText = rows.first().text().replaceAll(/\s+/g, " ").trim();
const hasTokenError =
$body.text().includes("GetAuthTokenAsync") ||
$body.text().includes("Error retrieving Token");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class TestDataHelper {
* Parse currency string to number
*/
static parseCurrency(currencyString: string): number {
return Number.parseFloat(currencyString.replace(/[$,]/g, ""));
return Number.parseFloat(currencyString.replaceAll(/[$,]/g, ""));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@
let src = $('#scoresheetTitle');
let dest = $('#scoresheetName');
let name = src.val().toLowerCase().trim() + '-v1';
dest.val(name.replace(/\s+/g, ""));
dest.val(name.replaceAll(/\s+/g, ""));
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@

function onNumberInput(value) {
let clamped = Number.parseInt(value, 10);
if (isNaN(clamped)) clamped = 0;
if (Number.isNaN(clamped)) clamped = 0;
clamped = Math.min(100, Math.max(0, clamped));
document.getElementById('FieldWidth').value = clamped;
document.getElementById('FieldColumns').value = widthToColumns(clamped);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
let src = $('#worksheetTitle');
let dest = $('#worksheetName');
let name = src.val().toLowerCase().trim() + '-v1';
dest.val(name.replace(/\s+/g, ""));
dest.val(name.replaceAll(/\s+/g, ""));
}

function deleteWorksheet() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function calculateDatagridColumnSum(table, columnIndex) {
let total = 0;
table.column(columnIndex).data().each(function (value) {
// Remove currency symbols and commas for numeric check
let cleanedValue = value.replace(/[^\d.-]/g, '');
let cleanedValue = value.replaceAll(/[^\d.-]/g, '');
if (isDatagridCellNumeric(cleanedValue)) {
total += Number.parseFloat(cleanedValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function closePaymentModal() {
}

function checkMaxValue(applicationId, input, amountRemaining) {
let enteredValue = Number.parseFloat(input.value.replace(/,/g, ""));
let enteredValue = Number.parseFloat(input.value.replaceAll(',', ""));
let remainingErrorId = "#column_" + applicationId + "_remaining_error";
if (amountRemaining < enteredValue) {
$(remainingErrorId).css("display", "block");
Expand Down Expand Up @@ -113,7 +113,7 @@ function calculateUpdateTotalAmount() {
let total = 0;
$('.amount').each(function () {
// Remove commas and $ symbols before parsing
let rawValue = $(this).val().replace(/[$,]/g, '');
let rawValue = $(this).val().replaceAll(/[$,]/g, '');
let value = Number.parseFloat(rawValue) || 0;
total += value;
this.value = upatePaymentNumberFormatter.format(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function checkMaxValueRequest(applicationId, input, amountRemaining) {
validateParentChildAmounts(applicationId);
} else {
// Use existing remaining amount validation
let enteredValue = Number.parseFloat(input.value.replace(/,/g, ''));
let enteredValue = Number.parseFloat(input.value.replaceAll(',', ''));
let remainingErrorId = '#error_column_' + applicationId;
if (amountRemaining < enteredValue) {
$(remainingErrorId).css('display', 'block');
Expand Down Expand Up @@ -94,7 +94,7 @@ function validateAllPaymentAmounts() {
).val()
);
let enteredValue =
Number.parseFloat(amountInput.val().replace(/,/g, '')) || 0;
Number.parseFloat(amountInput.val().replaceAll(',', '')) || 0;
let remainingErrorId = `#error_column_${correlationId}`;

if (enteredValue > remainingAmount) {
Expand Down Expand Up @@ -127,7 +127,7 @@ function submitPayments() {
function calculateTotalAmount() {
let total = 0;
$('.amount').each(function () {
let value = Number.parseFloat($(this).val().replace(/,/g, '')) || 0;
let value = Number.parseFloat($(this).val().replaceAll(',', '')) || 0;
total += value;
});

Expand Down Expand Up @@ -170,7 +170,7 @@ function formatCurrency(value) {
const numericValue =
typeof value === 'number'
? value
: Number.parseFloat(String(value ?? '').replace(/,/g, ''));
: Number.parseFloat(String(value ?? '').replaceAll(',', ''));
return cadFormatter.format(
Number.isFinite(numericValue) ? numericValue : 0
);
Expand Down Expand Up @@ -231,7 +231,7 @@ function validateParentChildAmounts(correlationId) {
let amountInput = $(
`input[name="ApplicationPaymentRequestForm[${itemIndex}].Amount"]`
);
let amount = Number.parseFloat(amountInput.val().replace(/,/g, '')) || 0;
let amount = Number.parseFloat(amountInput.val().replaceAll(',', '')) || 0;
groupTotal += amount;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ $(function () {

let filtered_submissions = submissions.filter(x =>
x.tenant.toLowerCase().includes($('#ReconciliationTenantFilter').val().toLowerCase()) &&
(isNaN(dateTo.getTime()) || new Date(x.createdAt) <= dateTo) &&
(isNaN(dateFrom.getTime()) || new Date(x.createdAt) >= dateFrom) &&
(Number.isNaN(dateTo.getTime()) || new Date(x.createdAt) <= dateTo) &&
(Number.isNaN(dateFrom.getTime()) || new Date(x.createdAt) >= dateFrom) &&
(x.category == $("#ReconciliationCategoryFilter").val() || $("#ReconciliationCategoryFilter").val() == "all")
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@

function _renderFeatureItem(feature) {
let id = 'ft-' + feature.name.replaceAll('.', '-');
let checked = feature.value === 'true' ? ' checked' : '';
let checked = (feature.value || '').toLowerCase() === 'true' ? ' checked' : '';
return '<div class="form-check form-switch mb-2">' +
'<input class="form-check-input" type="checkbox" id="' + id + '"' +
' data-feature-name="' + feature.name + '"' + checked + '>' +
Expand Down Expand Up @@ -270,7 +270,7 @@
if (!_featuresLoaded) return;
let features = [];
$('#config-features-content input[type="checkbox"]').each(function () {
features.push({ name: $(this).data('feature-name'), value: $(this).prop('checked').toString() });
features.push({ name: $(this).data('feature-name'), value: $(this).prop('checked') ? 'True' : 'False' });
});
$('#config-features-json').val(JSON.stringify(features));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ internal static List<UpdateFeatureDto> BuildFeatureUpdates(string? featureKeysRa

return featureKeysRaw
.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)
.Select(key => new UpdateFeatureDto { Name = key, Value = "true" })
.Select(key => new UpdateFeatureDto { Name = key, Value = "True" })
.ToList();
}
}
Expand Down
Loading
Loading