1
- import { OverlayModule } from '@angular/cdk/overlay' ;
2
1
import {
3
2
Component ,
4
3
DebugElement ,
@@ -12,14 +11,22 @@ import { By } from '@angular/platform-browser';
12
11
import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
13
12
14
13
import { DaffMenuComponent } from '../menu/menu.component' ;
15
- import { DaffMenuModule } from '../menu.module' ;
16
-
17
- @Component ( { template : `
18
- <daff-menu>
19
- <a href="/test" daff-menu-item id="focused">Test</a>
20
- <button daff-menu-item id="not-focused">Test 2</button>
21
- </daff-menu>
22
- ` } )
14
+ import { DaffMenuItemComponent } from '../menu-item/menu-item.component' ;
15
+ import { provideTestMenuService } from '../testing/dummy-service' ;
16
+
17
+ @Component ( {
18
+ template : `
19
+ <daff-menu>
20
+ <a href="/test" daff-menu-item id="focused">Test</a>
21
+ <button daff-menu-item id="not-focused">Test 2</button>
22
+ </daff-menu>
23
+ ` ,
24
+ standalone : true ,
25
+ imports : [
26
+ DaffMenuComponent ,
27
+ DaffMenuItemComponent ,
28
+ ] ,
29
+ } )
23
30
class WrapperComponent { }
24
31
25
32
describe ( '@daffodil/design/menu | DaffMenuComponent' , ( ) => {
@@ -32,11 +39,11 @@ describe('@daffodil/design/menu | DaffMenuComponent', () => {
32
39
TestBed . configureTestingModule ( {
33
40
imports : [
34
41
NoopAnimationsModule ,
35
- DaffMenuModule ,
36
- ] ,
37
- declarations : [
38
42
WrapperComponent ,
39
43
] ,
44
+ providers : [
45
+ provideTestMenuService ( ) ,
46
+ ] ,
40
47
} )
41
48
. compileComponents ( ) ;
42
49
} ) ) ;
@@ -55,8 +62,6 @@ describe('@daffodil/design/menu | DaffMenuComponent', () => {
55
62
} ) ;
56
63
57
64
it ( 'should focus the first focusable child' , ( ) => {
58
- expect (
59
- document . activeElement === de . query ( By . css ( '#focused' ) ) . nativeElement ,
60
- ) . toEqual ( true ) ;
65
+ expect ( document . activeElement === de . query ( By . css ( '#focused' ) ) . nativeElement ) . toEqual ( true ) ;
61
66
} ) ;
62
67
} ) ;
0 commit comments