diff --git a/app/javascript/__tests__/case_contact.test.js b/app/javascript/__tests__/case_contact.test.js deleted file mode 100644 index 0183881988..0000000000 --- a/app/javascript/__tests__/case_contact.test.js +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-env jest */ -/** - * @jest-environment jsdom - */ - -import { convertDateToSystemTimeZone } from '../src/case_contact' - -describe('convertDateToSystemTimeZone', () => { - test('converts a UTC date string to a Date object', () => { - const dateString = '2022-06-22 17:14:50 UTC' - const result = convertDateToSystemTimeZone(dateString) - - expect(result).toBeInstanceOf(Date) - expect(result.getTime()).toBe(new Date(dateString).getTime()) - }) - - test('converts a date string without timezone to a Date object', () => { - const dateString = '2022-06-22T12:00:00' - const result = convertDateToSystemTimeZone(dateString) - - expect(result).toBeInstanceOf(Date) - expect(result.getFullYear()).toBe(2022) - expect(result.getMonth()).toBe(5) // June is month 5 (0-indexed) - expect(result.getDate()).toBe(22) - }) - - test('creates a copy of an existing Date object', () => { - const originalDate = new Date('2022-06-22 17:14:50 UTC') - const result = convertDateToSystemTimeZone(originalDate) - - expect(result).toBeInstanceOf(Date) - expect(result.getTime()).toBe(originalDate.getTime()) - expect(result).not.toBe(originalDate) // Should be a different object - }) - - test('handles ISO 8601 format', () => { - const dateString = '2022-06-22T17:14:50.000Z' - const result = convertDateToSystemTimeZone(dateString) - - expect(result).toBeInstanceOf(Date) - expect(result.toISOString()).toBe(dateString) - }) - - test('returns Invalid Date for invalid date strings', () => { - const result = convertDateToSystemTimeZone('not a valid date') - - expect(result).toBeInstanceOf(Date) - expect(isNaN(result.getTime())).toBe(true) - }) -}) diff --git a/app/javascript/application.js b/app/javascript/application.js index a959785cdf..45bf9e6013 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -10,7 +10,6 @@ Turbo.session.drive = false require('datatables.net-dt')(null, window.jQuery) // First parameter is the global object. Defaults to window if null require('@rails/ujs').start() require('@rails/activestorage').start() -require('./src/case_contact') require('./src/case_emancipation') require('./src/casa_case') require('./src/new_casa_case') diff --git a/app/javascript/src/case_contact.js b/app/javascript/src/case_contact.js deleted file mode 100644 index cbc93ce759..0000000000 --- a/app/javascript/src/case_contact.js +++ /dev/null @@ -1,15 +0,0 @@ -/* global $ */ - -function convertDateToSystemTimeZone (date) { - return new Date((typeof date === 'string' ? new Date(date) : date)) -} - -$(document).on('turbo:load', function () { - $('.filter-form').on('change', '.filter-input', function () { - $(this).closest('form').submit() - }) -}) - -export { - convertDateToSystemTimeZone -} diff --git a/app/views/case_contacts/index.html.erb b/app/views/case_contacts/index.html.erb index f38cee057b..941e19b720 100644 --- a/app/views/case_contacts/index.html.erb +++ b/app/views/case_contacts/index.html.erb @@ -32,8 +32,8 @@ - <%= form_for_filterrific @filterrific, url: case_contacts_path, html: {class: "filter-form mb-6"}, remote: true, - data: {turbo: true, turbo_frame: :case_contacts, turbo_action: :advance} do |f| %> + <%= form_for_filterrific @filterrific, url: case_contacts_path, html: {class: "filter-form mb-6"}, + data: {controller: "auto-submit"} do |f| %> <%= hidden_field_tag "casa_case_id", params[:casa_case_id] %> <% panel_open = filters_open? %> @@ -54,7 +54,7 @@ Not "Filter by" -- it changes the order, not which rows show. %> <%= f.label :sorted_by, "Sort by", class: label_class %>