-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(design): change daffManageContainerLayoutMixin to a directive
- Loading branch information
1 parent
b00d1e1
commit c2111b3
Showing
8 changed files
with
93 additions
and
74 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
26 changes: 0 additions & 26 deletions
26
libs/design/src/core/manage-container-layout/manage-container-layout-mixin.ts
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
libs/design/src/core/manage-container-layout/manage-container-layout.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,57 @@ | ||
import { | ||
Component, | ||
DebugElement, | ||
} from '@angular/core'; | ||
import { | ||
waitForAsync, | ||
ComponentFixture, | ||
TestBed, | ||
} from '@angular/core/testing'; | ||
import { By } from '@angular/platform-browser'; | ||
|
||
import { DaffManageContainerLayoutDirective } from './manage-container-layout.directive'; | ||
|
||
@Component({ | ||
template: ` | ||
<div daffManageContainerLayout></div>`, | ||
}) | ||
|
||
class WrapperComponent {} | ||
|
||
describe('@daffodil/design | DaffManageContainerLayoutDirective', () => { | ||
let wrapper: WrapperComponent; | ||
let de: DebugElement; | ||
let fixture: ComponentFixture<WrapperComponent>; | ||
let directive: DaffManageContainerLayoutDirective; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ | ||
WrapperComponent, | ||
], | ||
imports: [ | ||
DaffManageContainerLayoutDirective, | ||
], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(WrapperComponent); | ||
wrapper = fixture.componentInstance; | ||
de = fixture.debugElement.query(By.css('[daffManageContainerLayout]')); | ||
directive = de.injector.get(DaffManageContainerLayoutDirective); | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(wrapper).toBeTruthy(); | ||
expect(directive).toBeTruthy(); | ||
}); | ||
|
||
it('should add a class of "daff-manage-container-layout" to the host element', () => { | ||
expect(de.classes).toEqual(jasmine.objectContaining({ | ||
'daff-manage-container-layout': true, | ||
})); | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
libs/design/src/core/manage-container-layout/manage-container-layout.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, | ||
HostBinding, | ||
} from '@angular/core'; | ||
|
||
/** | ||
* A directive that gives a component the ability to manage a DaffContainerComponent's layout. | ||
* It passes predetermined layout styles down to the container. In order for a component to | ||
* do this, it must includes this directive as a hostDirective. | ||
*/ | ||
@Directive({ | ||
selector: '[daffManageContainerLayout]', | ||
standalone: true, | ||
}) | ||
|
||
export class DaffManageContainerLayoutDirective { | ||
@HostBinding('class.daff-manage-container-layout') class = true; | ||
} |
35 changes: 0 additions & 35 deletions
35
libs/design/src/core/manage-container-layout/manage-container-layout.spec.ts
This file was deleted.
Oops, something went wrong.
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 +1 @@ | ||
export { daffManageContainerLayoutMixin } from './manage-container-layout-mixin'; | ||
export { DaffManageContainerLayoutDirective } from './manage-container-layout.directive'; |