Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Issue-25962] SEO improvements use a hand cursor for edit and preview…
… buttons (#26473) * Merging with master * Merging with master * Merging with master * #25959 Adding image broken * Merging with master * #25959 Css fixes' * Merging with master * Merging with master * #25959 fix image not found * #25959 fix image not found * Adding meta tags service * PR feedback * Adding refactor * Adding refactor * Adding more tests for validate the test scenarios * Adding favicon validation * #25962 cursor pointer * Refactor service * Refactor service * Adding refactor service * Fixing tests
- Loading branch information
1 parent
d959fa7
commit c5e41bb
Showing
11 changed files
with
952 additions
and
358 deletions.
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
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
76 changes: 76 additions & 0 deletions
76
...c/app/portlets/dot-edit-page/content/services/html/dot-seo-meta-tags-util.service.spec.ts
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,76 @@ | ||
import { SpectatorService, createServiceFactory } from '@ngneat/spectator'; | ||
|
||
import { DotMessageService } from '@dotcms/data-access'; | ||
|
||
import { DotSeoMetaTagsUtilService } from './dot-seo-meta-tags-util.service'; | ||
|
||
import { SEO_RULES_COLORS, SEO_RULES_ICONS } from '../dot-edit-content-html/models/meta-tags-model'; | ||
|
||
describe('DotSeoMetaTagsUtilService', () => { | ||
let spectator: SpectatorService<DotSeoMetaTagsUtilService>; | ||
const createService = createServiceFactory(DotSeoMetaTagsUtilService); | ||
|
||
beforeEach(() => { | ||
spectator = createService({ | ||
providers: [ | ||
{ | ||
provide: DotMessageService, | ||
useValue: { | ||
get: (key: string) => key | ||
} | ||
} | ||
] | ||
}); | ||
}); | ||
|
||
it('should add HTML tags to a message', () => { | ||
const message = 'og:title This is a test message with SEO_TAGS'; | ||
const result = spectator.service.addHTMLTag(message); | ||
|
||
expect(result).toContain('<code>og:title</code>'); | ||
}); | ||
|
||
it('should return an error item', () => { | ||
const message = 'Error message'; | ||
const result = spectator.service.getErrorItem(message); | ||
|
||
expect(result.message).toEqual(spectator.service.addHTMLTag(message)); | ||
expect(result.color).toBe(SEO_RULES_COLORS.ERROR); | ||
expect(result.itemIcon).toBe(SEO_RULES_ICONS.TIMES); | ||
}); | ||
|
||
it('should return a warning item', () => { | ||
const message = 'Warning message'; | ||
const result = spectator.service.getWarningItem(message); | ||
|
||
expect(result.message).toEqual(spectator.service.addHTMLTag(message)); | ||
expect(result.color).toBe(SEO_RULES_COLORS.WARNING); | ||
expect(result.itemIcon).toBe(SEO_RULES_ICONS.EXCLAMATION_CIRCLE); | ||
}); | ||
|
||
it('should return a done item', () => { | ||
const message = 'Done message'; | ||
const result = spectator.service.getDoneItem(message); | ||
|
||
expect(result.message).toEqual(spectator.service.addHTMLTag(message)); | ||
expect(result.color).toBe(SEO_RULES_COLORS.DONE); | ||
expect(result.itemIcon).toBe(SEO_RULES_ICONS.CHECK); | ||
}); | ||
|
||
it('should validate that all values are falsy or empty', () => { | ||
const falsyValues: (string | NodeListOf<Element>)[] = [null, undefined, '']; | ||
const result = spectator.service.areAllFalsyOrEmpty(falsyValues); | ||
|
||
expect(result).toBe(true); | ||
|
||
const nonEmptyValues: (string | NodeListOf<Element>)[] = [ | ||
null, | ||
undefined, | ||
'test', | ||
document.querySelectorAll('div') | ||
]; | ||
const nonEmptyResult = spectator.service.areAllFalsyOrEmpty(nonEmptyValues); | ||
|
||
expect(nonEmptyResult).toBe(false); | ||
}); | ||
}); |
Oops, something went wrong.