diff --git a/tests/javascripts/listEntry.test.js b/tests/javascripts/listEntry.test.js
index d2409d03b..5d11546dc 100644
--- a/tests/javascripts/listEntry.test.js
+++ b/tests/javascripts/listEntry.test.js
@@ -352,4 +352,72 @@ describe("List entry", () => {
});
});
+
+ describe("getOriginalClasses functionality", () => {
+ test("Should handle inputs without any classes", () => {
+ // Create input without classes
+ document.body.innerHTML = `
+
`;
+
+ inputList = document.querySelector('.input-list');
+
+ // start module
+ window.GOVUK.modules.start();
+
+ // Check that it handles missing classes gracefully
+ const newInput = inputList.querySelector('.list-entry input');
+ expect(newInput).not.toBeNull();
+ });
+
+ test("Should handle empty input list", () => {
+ // Create div without any inputs
+ document.body.innerHTML = `
+
+
`;
+
+ inputList = document.querySelector('.input-list');
+
+ // This should not throw an error
+ expect(() => {
+ window.GOVUK.modules.start();
+ }).not.toThrow();
+ });
+ });
+
+ describe("getId functionality", () => {
+ test("Should generate IDs correctly with and without number parameter", () => {
+ // Set up a simpler structure to test ID generation
+ document.body.innerHTML = `
+ `;
+
+ inputList = document.querySelector('.input-list');
+
+ // start module
+ window.GOVUK.modules.start();
+
+ // After module starts, check that IDs are generated correctly
+ // The module will have regenerated the DOM
+ const inputs = inputList.querySelectorAll('input');
+
+ // Check that inputs have proper IDs with numbers
+ expect(inputs[0].id).toEqual("test-1");
+ expect(inputs[1].id).toEqual("test-2");
+
+ // The getId function is called internally during render
+ // We can verify it worked by checking the generated HTML structure
+ expect(inputList.innerHTML).toContain('id="test-1"');
+ expect(inputList.innerHTML).toContain('id="test-2"');
+ });
+ });
});