File tree Expand file tree Collapse file tree 6 files changed +54
-6
lines changed
tests/integration/components Expand file tree Collapse file tree 6 files changed +54
-6
lines changed Original file line number Diff line number Diff line change
1
+ import Component from '@glimmer/component' ;
2
+ import { tracked } from '@glimmer/tracking' ;
3
+ import { action } from '@ember/object' ;
4
+
5
+ export default class ButtonComponent extends Component {
6
+ @tracked
7
+ value = 0 ;
8
+
9
+ @action
10
+ incrementValue ( ) {
11
+ this . value ++ ;
12
+ }
13
+ }
Original file line number Diff line number Diff line change @@ -19,11 +19,11 @@ Also supported- block use:
19
19
To add interactivity you can pass an action to ` onClicked `
20
20
21
21
``` handlebars
22
- <EsButton @onClicked={{action (mut value) (increment value) }}>
22
+ <EsButton @onClicked={{this.incrementValue }}>
23
23
Increment Value
24
24
</EsButton>
25
25
26
- {{value}}
26
+ {{this. value}}
27
27
```
28
28
29
29
## Secondary Buttons
Original file line number Diff line number Diff line change
1
+ import Component from '@glimmer/component' ;
2
+
3
+ export default class HeaderComponent extends Component {
4
+ links = [
5
+ {
6
+ name : 'Example Links' ,
7
+ type : 'dropdown' ,
8
+ items : [
9
+ {
10
+ href : 'https://guides.emberjs.com/release/' ,
11
+ name : 'Ember.js Guides' ,
12
+ type : 'link' ,
13
+ } ,
14
+ {
15
+ href : 'https://api.emberjs.com' ,
16
+ name : 'API Reference' ,
17
+ type : 'link' ,
18
+ } ,
19
+ {
20
+ href : 'https://cli.emberjs.com' ,
21
+ name : 'CLI Guides' ,
22
+ type : 'link' ,
23
+ } ,
24
+ {
25
+ type : 'divider' ,
26
+ } ,
27
+ {
28
+ href : 'https://emberjs.com/learn' ,
29
+ name : 'Learn Ember' ,
30
+ type : 'link' ,
31
+ } ,
32
+ ] ,
33
+ } ,
34
+ ] ;
35
+ }
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ Shows the side wide header with the global navigation.
9
9
If you would like to override the default links you can pass a json object to update the links in the navbar.
10
10
11
11
``` handlebars
12
- <EsHeader @links={{links}} />
12
+ <EsHeader @links={{this. links}} />
13
13
```
14
14
15
15
You can also use the block form of the component to add extra HTML to the navigation bar
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ module('Integration | Component | es button', function(hooks){
36
36
37
37
await render ( hbs `
38
38
{{es-button
39
- label=label
39
+ label=this. label
40
40
}}
41
41
` ) ;
42
42
@@ -48,7 +48,7 @@ module('Integration | Component | es button', function(hooks){
48
48
49
49
setProperties ( this , { onClicked } ) ;
50
50
51
- await render ( hbs `{{es-button onClicked=onClicked}}` ) ;
51
+ await render ( hbs `{{es-button onClicked=this. onClicked}}` ) ;
52
52
await click ( 'button' ) ;
53
53
54
54
assert . ok ( onClicked . calledOnce , 'onClicked called' ) ;
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ module('Integration | Component | es header', function(hooks) {
32
32
33
33
test ( 'it renders a link to a custom homepage' , async function ( assert ) {
34
34
setProperties ( this , { customHomeUrl } ) ;
35
- await render ( hbs `<EsHeader @home={{customHomeUrl}} />` ) ;
35
+ await render ( hbs `<EsHeader @home={{this. customHomeUrl}} />` ) ;
36
36
37
37
assert . dom ( '.navbar-brand-wrapper' ) . hasAttribute ( 'href' , customHomeUrl ) ;
38
38
} ) ;
You can’t perform that action at this time.
0 commit comments