From c1d484864dda04644f6727426bb8e0346d31941e Mon Sep 17 00:00:00 2001 From: Kyle Angelo Galendez Date: Thu, 13 Jun 2024 13:23:41 +0800 Subject: [PATCH] style: expand print width to 100 characters Adjusted code formatting to adhere to a maximum print width of 100characters, improving readability and consistency across the codebase. --- src/components/__tests__/button.test.js | 48 ++++++++++++++++++------- src/components/button.js | 8 ++++- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/src/components/__tests__/button.test.js b/src/components/__tests__/button.test.js index d965be2..a552aa1 100644 --- a/src/components/__tests__/button.test.js +++ b/src/components/__tests__/button.test.js @@ -45,13 +45,17 @@ describe('Button', () => { expect(button).toBeDefined() expect(mock_log).toHaveBeenCalledWith('It worked!') expect(element.id).toBe('button-add-quiz') - expect(element.className).toBe('maker-button button rounded-square-button') + expect(element.className).toBe( + 'maker-button button rounded-square-button' + ) expect(element.querySelector('[data-lucide="plus"]')).not.toBeNull() }) describe('should create a slab type button', () => { it('should create a button with icon and text', () => { - const mock_log = jest.spyOn(console, 'log').mockImplementation(() => {}) + const mock_log = jest + .spyOn(console, 'log') + .mockImplementation(() => {}) const config = { icon: 'attachment', @@ -81,11 +85,15 @@ describe('Button', () => { expect(mock_log).toHaveBeenCalledWith('It worked!') expect(element.id).toBe('button-import-file') expect(element.className).toBe('maker-button button slab-button') - expect(element.querySelector('[data-lucide="attachment"]')).not.toBeNull() + expect( + element.querySelector('[data-lucide="attachment"]') + ).not.toBeNull() }) it('should create a button with text only', () => { - const mock_log = jest.spyOn(console, 'log').mockImplementation(() => {}) + const mock_log = jest + .spyOn(console, 'log') + .mockImplementation(() => {}) const config = { text: 'Import File', @@ -117,7 +125,9 @@ describe('Button', () => { }) it('should not create a button without icon and text', () => { - const mock_log = jest.spyOn(console, 'log').mockImplementation(() => {}) + const mock_log = jest + .spyOn(console, 'log') + .mockImplementation(() => {}) const config = { id: 'import-file', @@ -142,7 +152,9 @@ describe('Button', () => { describe('should create a default type button', () => { it('should create a button with icon and text', () => { - const mock_log = jest.spyOn(console, 'log').mockImplementation(() => {}) + const mock_log = jest + .spyOn(console, 'log') + .mockImplementation(() => {}) const config = { icon: 'attachment', @@ -170,12 +182,18 @@ describe('Button', () => { expect(button).toBeDefined() expect(mock_log).toHaveBeenCalledWith('It worked!') expect(element.id).toBe('button-import-file') - expect(element.className).toBe('maker-button button transparent-button') - expect(element.querySelector('[data-lucide="attachment"]')).not.toBeNull() + expect(element.className).toBe( + 'maker-button button transparent-button' + ) + expect( + element.querySelector('[data-lucide="attachment"]') + ).not.toBeNull() }) it('should create a button with text only', () => { - const mock_log = jest.spyOn(console, 'log').mockImplementation(() => {}) + const mock_log = jest + .spyOn(console, 'log') + .mockImplementation(() => {}) const config = { text: 'Import File', @@ -202,11 +220,15 @@ describe('Button', () => { expect(button).toBeDefined() expect(mock_log).toHaveBeenCalledWith('It worked!') expect(element.id).toBe('button-import-file') - expect(element.className).toBe('maker-button button transparent-button') + expect(element.className).toBe( + 'maker-button button transparent-button' + ) }) it('should not create a button without icon and text', () => { - const mock_log = jest.spyOn(console, 'log').mockImplementation(() => {}) + const mock_log = jest + .spyOn(console, 'log') + .mockImplementation(() => {}) const config = { id: 'import-file', @@ -259,7 +281,9 @@ describe('Button', () => { expect(button).toBeDefined() expect(mock_log).toHaveBeenCalledWith('It worked!') expect(element.id).toBe('button-add-quiz') - expect(element.className).toBe('maker-button button rounded-square-button') + expect(element.className).toBe( + 'maker-button button rounded-square-button' + ) expect(element.querySelector('[data-lucide="plus"]')).not.toBeNull() button.remove() diff --git a/src/components/button.js b/src/components/button.js index f3ad51a..8d7ddbe 100644 --- a/src/components/button.js +++ b/src/components/button.js @@ -42,7 +42,13 @@ class Button { switch (type) { case 'rounded-square': text = undefined - node = this.#createContainer(icon, text, id, class_name, 'rounded-square') + node = this.#createContainer( + icon, + text, + id, + class_name, + 'rounded-square' + ) break case 'slab': if (!text && !icon) return