Skip to content

Commit

Permalink
style: expand print width to 100 characters
Browse files Browse the repository at this point in the history
Adjusted code formatting to adhere to a maximum print width of 100characters, improving readability and consistency across the codebase.
  • Loading branch information
chessurisme committed Jun 13, 2024
1 parent 18379fd commit c1d4848
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 13 deletions.
48 changes: 36 additions & 12 deletions src/components/__tests__/button.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 7 additions & 1 deletion src/components/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c1d4848

Please sign in to comment.