-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
task/WP-355: Fixing issue with icons on dev/prod sites (#892)
* fixing issue with icons all defaulting to icon-applications on dev/prod site * getting rid of console.logs --------- Co-authored-by: Taylor Grafft <[email protected]>
- Loading branch information
Showing
2 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import doesClassExist from './doesClassExist'; | ||
|
||
const mockStylesheet = ` | ||
.icon-upload:before { | ||
content: "\\ea57" | ||
} | ||
.icon-user-reverse:before { | ||
content: "\\ea58" | ||
} | ||
.icon-user:before { | ||
content: "\\ea59" | ||
} | ||
.icon-visualization:before { | ||
content: "\\ea5a" | ||
} | ||
.icon-zoom-in:before { | ||
content: "\\ea5b" | ||
} | ||
.icon-zoom-out:before { | ||
content: "\\ea5c" | ||
} | ||
`; | ||
|
||
describe('doesClassExist', () => { | ||
it('should return true for existing class in string stylesheet', async () => { | ||
const result = doesClassExist('icon-visualization', [mockStylesheet]); | ||
expect(result).toBe(true); | ||
}); | ||
|
||
it('should return false for non-existing class in string stylesheet', async () => { | ||
const result = doesClassExist('icon-nonexistent', [mockStylesheet]); | ||
expect(result).toBe(false); | ||
}); | ||
|
||
it('should return true for existing class in object stylesheet', async () => { | ||
const mockStylesheetObject = { | ||
'icon-visualization': true, | ||
}; | ||
const result = doesClassExist('icon-visualization', [mockStylesheetObject]); | ||
expect(result).toBe(true); | ||
}); | ||
|
||
it('should return false for non-existing class in object stylesheet', async () => { | ||
const mockStylesheetObject = { | ||
'icon-visualization': true, | ||
}; | ||
const result = doesClassExist('icon-nonexistent', [mockStylesheetObject]); | ||
expect(result).toBe(false); | ||
}); | ||
}); |