-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): update Notifications to latest design #12476
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
13 changes: 6 additions & 7 deletions
13
libs/core/notification/directives/notification-footer-content.directive.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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import { Directive, HostBinding } from '@angular/core'; | ||
import { Directive } from '@angular/core'; | ||
|
||
@Directive({ | ||
selector: '[fdNotificationFooterContent], [fd-notification-footer-content]', | ||
standalone: true | ||
standalone: true, | ||
host: { | ||
class: 'fd-notification__footer-content' | ||
} | ||
}) | ||
export class NotificationFooterContentDirective { | ||
/** @hidden */ | ||
@HostBinding('class.fd-notification__footer-content') | ||
fdNotificationTitleClass = true; | ||
} | ||
export class NotificationFooterContentDirective {} |
36 changes: 36 additions & 0 deletions
36
libs/core/notification/directives/notification-group-growing-item-title.directive.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,36 @@ | ||
import { Component, ElementRef, ViewChild } from '@angular/core'; | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { NotificationModule } from '../notification.module'; | ||
|
||
@Component({ | ||
template: `<span #directiveElement fd-notification-group-growing-item-title>Notification Group Growing Item Title Test</span> ` | ||
}) | ||
class TestComponent { | ||
@ViewChild('directiveElement') | ||
ref: ElementRef; | ||
} | ||
describe('NotificationGroupGrowingItemTitleDirective', () => { | ||
let component: TestComponent; | ||
let fixture: ComponentFixture<TestComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [TestComponent], | ||
imports: [NotificationModule] | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(TestComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should assign class', () => { | ||
expect(component.ref.nativeElement.className).toBe('fd-notification-group__growing-item-title'); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
libs/core/notification/directives/notification-group-growing-item-title.directive.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,10 @@ | ||
import { Directive } from '@angular/core'; | ||
|
||
@Directive({ | ||
selector: '[fdNotificationGroupGrowingItemTitle], [fd-notification-group-growing-item-title]', | ||
standalone: true, | ||
host: { | ||
class: 'fd-notification-group__growing-item-title' | ||
} | ||
}) | ||
export class NotificationGroupGrowingItemTitleDirective {} |
44 changes: 44 additions & 0 deletions
44
libs/core/notification/directives/notification-group-header-title.directive.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,44 @@ | ||
import { Component, ElementRef, ViewChild } from '@angular/core'; | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { NotificationModule } from '../notification.module'; | ||
|
||
@Component({ | ||
template: `<span #directiveElement fd-notification-group-header-title>Notification Group Header Title Test</span> ` | ||
}) | ||
class TestComponent { | ||
@ViewChild('directiveElement') | ||
ref: ElementRef; | ||
} | ||
describe('NotificationGroupHeaderTitleDirective', () => { | ||
let component: TestComponent; | ||
let fixture: ComponentFixture<TestComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [TestComponent], | ||
imports: [NotificationModule] | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(TestComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should assign class', () => { | ||
expect(component.ref.nativeElement.className).toBe('fd-notification-group__header-title'); | ||
}); | ||
|
||
it('should assign default role', () => { | ||
expect(component.ref.nativeElement.getAttribute('role')).toBe('heading'); | ||
}); | ||
|
||
it('should assign default aria level', () => { | ||
expect(component.ref.nativeElement.getAttribute('aria-level')).toBe('3'); | ||
}); | ||
}); |
35 changes: 35 additions & 0 deletions
35
libs/core/notification/directives/notification-group-header-title.directive.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,35 @@ | ||
import { Directive, input } from '@angular/core'; | ||
import { FD_NOTIFICATION_GROUP_HEADER_TITLE } from '../token'; | ||
|
||
let notificationGroupHeaderTitleCounter = 0; | ||
|
||
@Directive({ | ||
selector: '[fdNotificationGroupHeaderTitle], [fd-notification-group-header-title]', | ||
standalone: true, | ||
host: { | ||
class: 'fd-notification-group__header-title', | ||
role: 'heading', | ||
'[attr.aria-level]': 'ariaLevel()', | ||
'[attr.id]': 'id()' | ||
}, | ||
providers: [ | ||
{ | ||
provide: FD_NOTIFICATION_GROUP_HEADER_TITLE, | ||
useExisting: NotificationGroupHeaderTitleDirective | ||
} | ||
] | ||
}) | ||
export class NotificationGroupHeaderTitleDirective { | ||
/** | ||
* aria-level for the title | ||
* a numeric value from 1 to 6 | ||
* default value is 3 | ||
*/ | ||
ariaLevel = input<1 | 2 | 3 | 4 | 5 | 6>(3); | ||
|
||
/** | ||
* id for the notification group header title | ||
* if not set, a default value is provided | ||
*/ | ||
id = input('fd-notification-group-header-title-' + ++notificationGroupHeaderTitleCounter); | ||
} |
46 changes: 0 additions & 46 deletions
46
libs/core/notification/directives/notification-indicator.directive.spec.ts
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
libs/core/notification/directives/notification-indicator.directive.ts
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
libs/core/notification/directives/notification-limit-description.directive.ts
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
libs/core/notification/directives/notification-limit-title.directive.ts
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
libs/core/notification/directives/notification-list.directive.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,44 @@ | ||
import { Component, ElementRef, ViewChild } from '@angular/core'; | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { NotificationModule } from '../notification.module'; | ||
|
||
@Component({ | ||
template: `<div #directiveElement fd-notification-list>Notification List Test</div> ` | ||
}) | ||
class TestComponent { | ||
@ViewChild('directiveElement') | ||
ref: ElementRef; | ||
} | ||
describe('NotificationListDirective', () => { | ||
let component: TestComponent; | ||
let fixture: ComponentFixture<TestComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [TestComponent], | ||
imports: [NotificationModule] | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(TestComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should assign class', () => { | ||
expect(component.ref.nativeElement.className).toBe('fd-notification-list'); | ||
}); | ||
|
||
it('should assign default role', () => { | ||
expect(component.ref.nativeElement.getAttribute('role')).toBe('list'); | ||
}); | ||
|
||
it('should assign default aria lebel', () => { | ||
expect(component.ref.nativeElement.getAttribute('aria-label')).toBe('Notifications'); | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
libs/core/notification/directives/notification-list.directive.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,18 @@ | ||
import { Directive, input } from '@angular/core'; | ||
|
||
@Directive({ | ||
selector: '[fdNotificationList], [fd-notification-list]', | ||
standalone: true, | ||
host: { | ||
class: 'fd-notification-list', | ||
role: 'list', | ||
'[attr.aria-label]': 'ariaLabel()' | ||
} | ||
}) | ||
export class NotificationListDirective { | ||
/** | ||
* aria-label attribute for the element | ||
* Default is set to 'Notifications' | ||
*/ | ||
ariaLabel = input('Notifications'); | ||
} |
36 changes: 36 additions & 0 deletions
36
libs/core/notification/directives/notification-message-strip-container.directive.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,36 @@ | ||
import { Component, ElementRef, ViewChild } from '@angular/core'; | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { NotificationModule } from '../notification.module'; | ||
|
||
@Component({ | ||
template: `<div #directiveElement fd-notification-message-strip-container>Notification Message Strip Container Test</div> ` | ||
}) | ||
class TestComponent { | ||
@ViewChild('directiveElement') | ||
ref: ElementRef; | ||
} | ||
describe('NotificationMessageStripContainerDirective', () => { | ||
let component: TestComponent; | ||
let fixture: ComponentFixture<TestComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [TestComponent], | ||
imports: [NotificationModule] | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(TestComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should assign class', () => { | ||
expect(component.ref.nativeElement.className).toBe('fd-notification__message-strip-container'); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
libs/core/notification/directives/notification-message-strip-container.directive.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,10 @@ | ||
import { Directive } from '@angular/core'; | ||
|
||
@Directive({ | ||
selector: '[fdNotificationMessageStripContainer], [fd-notification-message-strip-container]', | ||
standalone: true, | ||
host: { | ||
class: 'fd-notification__message-strip-container' | ||
} | ||
}) | ||
export class NotificationMessageStripContainerDirective {} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be prepared for translation