Skip to content

Commit 678876b

Browse files
committed
Rename md-menu-trigger-for to mdMenuTriggerFor.
1 parent fd71f35 commit 678876b

File tree

6 files changed

+41
-41
lines changed

6 files changed

+41
-41
lines changed

src/demo-app/menu/menu-demo.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<p>You clicked on: {{ selected }}</p>
44

55
<md-toolbar>
6-
<button md-icon-button [md-menu-trigger-for]="menu" aria-label="Open basic menu">
6+
<button md-icon-button [mdMenuTriggerFor]="menu" aria-label="Open basic menu">
77
<md-icon>more_vert</md-icon>
88
</button>
99
</md-toolbar>
@@ -17,7 +17,7 @@
1717
<div class="menu-section">
1818
<p> Clicking these will navigate:</p>
1919
<md-toolbar>
20-
<button md-icon-button [md-menu-trigger-for]="anchorMenu" aria-label="Open anchor menu">
20+
<button md-icon-button [mdMenuTriggerFor]="anchorMenu" aria-label="Open anchor menu">
2121
<md-icon>more_vert</md-icon>
2222
</button>
2323
</md-toolbar>
@@ -33,7 +33,7 @@
3333
Position x: before
3434
</p>
3535
<md-toolbar class="end-icon">
36-
<button md-icon-button [md-menu-trigger-for]="posXMenu" aria-label="Open x-positioned menu">
36+
<button md-icon-button [mdMenuTriggerFor]="posXMenu" aria-label="Open x-positioned menu">
3737
<md-icon>more_vert</md-icon>
3838
</button>
3939
</md-toolbar>
@@ -50,7 +50,7 @@
5050
Position y: above
5151
</p>
5252
<md-toolbar>
53-
<button md-icon-button [md-menu-trigger-for]="posYMenu" aria-label="Open y-positioned menu">
53+
<button md-icon-button [mdMenuTriggerFor]="posYMenu" aria-label="Open y-positioned menu">
5454
<md-icon>more_vert</md-icon>
5555
</button>
5656
</md-toolbar>

src/e2e-app/menu/menu-e2e.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<div style="float:left">
33
<div id="text">{{ selected }}</div>
44
<button id="start">START</button>
5-
<button [md-menu-trigger-for]="menu" id="trigger">TRIGGER</button>
6-
<button [md-menu-trigger-for]="menu" id="trigger-two">TRIGGER 2</button>
5+
<button [mdMenuTriggerFor]="menu" id="trigger">TRIGGER</button>
6+
<button [mdMenuTriggerFor]="menu" id="trigger-two">TRIGGER 2</button>
77

88
<md-menu #menu="mdMenu" y-position="below" class="custom">
99
<button md-menu-item (click)="selected='one'">One</button>
@@ -12,20 +12,20 @@
1212
<button md-menu-item>Four</button>
1313
</md-menu>
1414

15-
<button [md-menu-trigger-for]="beforeMenu" id="before-t">
15+
<button [mdMenuTriggerFor]="beforeMenu" id="before-t">
1616
BEFORE
1717
</button>
1818
<md-menu x-position="before" y-position="below" class="before" #beforeMenu="mdMenu">
1919
<button md-menu-item>Item</button>
2020
</md-menu>
2121

2222
<div class="bottom-row">
23-
<button [md-menu-trigger-for]="aboveMenu" id="above-t">ABOVE</button>
23+
<button [mdMenuTriggerFor]="aboveMenu" id="above-t">ABOVE</button>
2424
<md-menu y-position="above" class="above" #aboveMenu="mdMenu">
2525
<button md-menu-item>Item</button>
2626
</md-menu>
2727

28-
<button [md-menu-trigger-for]="combined" id="combined-t">
28+
<button [mdMenuTriggerFor]="combined" id="combined-t">
2929
BOTH
3030
</button>
3131
<md-menu x-position="before" y-position="above" class="combined" #combined="mdMenu">

src/lib/menu/README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# md-menu
22

3-
`md-menu` is a list of options that displays when triggered. You can read more about menus in the
3+
`md-menu` is a list of options that displays when triggered. You can read more about menus in the
44
[Material Design spec](https://material.google.com/components/menus.html).
55

66
### Not yet implemented
@@ -13,8 +13,8 @@
1313

1414
### Simple menu
1515

16-
In your template, create an `md-menu` element. You can use either `<button>` or `<anchor>` tags for
17-
your menu items, as long as each is tagged with an `md-menu-item` attribute. Note that you can
16+
In your template, create an `md-menu` element. You can use either `<button>` or `<anchor>` tags for
17+
your menu items, as long as each is tagged with an `md-menu-item` attribute. Note that you can
1818
disable items by adding the `disabled` boolean attribute or binding to it.
1919

2020
*my-comp.html*
@@ -28,15 +28,15 @@ disable items by adding the `disabled` boolean attribute or binding to it.
2828
</md-menu>
2929
```
3030

31-
Menus are hidden by default, so you'll want to connect up a menu trigger that can open your menu.
32-
You can do so by adding a button tag with an `md-menu-trigger-for` attribute and passing in the menu
33-
instance. You can create a local reference to your menu instance by adding `#menu="mdMenu"` to
31+
Menus are hidden by default, so you'll want to connect up a menu trigger that can open your menu.
32+
You can do so by adding a button tag with an `mdMenuTriggerFor` attribute and passing in the menu
33+
instance. You can create a local reference to your menu instance by adding `#menu="mdMenu"` to
3434
your menu element.
3535

3636
*my-comp.html*
3737
```html
3838
<!-- menu opens when trigger button is clicked -->
39-
<button md-icon-button [md-menu-trigger-for]="menu">
39+
<button md-icon-button [mdMenuTriggerFor]="menu">
4040
<md-icon>more_vert</md-icon>
4141
</button>
4242

@@ -55,10 +55,10 @@ Output:
5555

5656
### Toggling the menu programmatically
5757

58-
You can also use the menu's API to open or close the menu programmatically from your class. Please
59-
note that in this case, an `md-menu-trigger-for` attribute is still necessary to connect
58+
You can also use the menu's API to open or close the menu programmatically from your class. Please
59+
note that in this case, an `mdMenuTriggerFor` attribute is still necessary to connect
6060
the menu to its trigger element in the DOM.
61-
61+
6262
*my-comp.component.ts*
6363
```ts
6464
class MyComp {
@@ -72,7 +72,7 @@ class MyComp {
7272

7373
*my-comp.html*
7474
```html
75-
<button md-icon-button [md-menu-trigger-for]="menu">
75+
<button md-icon-button [mdMenuTriggerFor]="menu">
7676
<md-icon>more_vert</md-icon>
7777
</button>
7878

@@ -91,15 +91,15 @@ Menus also support displaying `md-icon` elements before the menu item text.
9191
*my-comp.html*
9292
```html
9393
<md-menu #menu="mdMenu">
94-
<button md-menu-item>
94+
<button md-menu-item>
9595
<md-icon> dialpad </md-icon>
9696
<span> Redial </span>
9797
</button>
98-
<button md-menu-item disabled>
98+
<button md-menu-item disabled>
9999
<md-icon> voicemail </md-icon>
100100
<span> Check voicemail </span>
101101
</button>
102-
<button md-menu-item>
102+
<button md-menu-item>
103103
<md-icon> notifications_off </md-icon>
104104
<span> Disable alerts </span>
105105
</button>
@@ -114,8 +114,8 @@ Output:
114114

115115
### Customizing menu position
116116

117-
By default, the menu will display after and below its trigger. You can change this display position
118-
using the `x-position` (`before | after`) and `y-position` (`above | below`) attributes.
117+
By default, the menu will display after and below its trigger. You can change this display position
118+
using the `x-position` (`before | after`) and `y-position` (`above | below`) attributes.
119119

120120
*my-comp.html*
121121
```html
@@ -134,7 +134,7 @@ Output:
134134

135135
### Accessibility
136136

137-
The menu adds `role="menu"` to the main menu element and `role="menuitem"` to each menu item. It
137+
The menu adds `role="menu"` to the main menu element and `role="menuitem"` to each menu item. It
138138
also adds `aria-hasPopup="true"` to the trigger element.
139139

140140
#### Keyboard events:
@@ -146,26 +146,26 @@ also adds `aria-hasPopup="true"` to the trigger element.
146146

147147
| Signature | Values | Description |
148148
| --- | --- | --- |
149-
| `x-position` | `before | after` | The horizontal position of the menu in relation to the trigger. Defaults to `after`. |
149+
| `x-position` | `before | after` | The horizontal position of the menu in relation to the trigger. Defaults to `after`. |
150150
| `y-position` | `above | below` | The vertical position of the menu in relation to the trigger. Defaults to `below`. |
151-
151+
152152
### Trigger Programmatic API
153153

154154
**Properties**
155155

156156
| Name | Type | Description |
157157
| --- | --- | --- |
158-
| `menuOpen` | `Boolean` | Property that is true when the menu is open. It is not settable (use methods below). |
159-
| `onMenuOpen` | `Observable<void>` | Observable that emits when the menu opens. |
160-
| `onMenuClose` | `Observable<void>` | Observable that emits when the menu closes. |
158+
| `menuOpen` | `Boolean` | Property that is true when the menu is open. It is not settable (use methods below). |
159+
| `onMenuOpen` | `Observable<void>` | Observable that emits when the menu opens. |
160+
| `onMenuClose` | `Observable<void>` | Observable that emits when the menu closes. |
161161

162162
**Methods**
163163

164164
| Method | Returns | Description |
165165
| --- | --- | --- |
166166
| `openMenu()` | `Promise<void>` | Opens the menu. Returns a promise that will resolve when the menu has opened. |
167167
| `closeMenu()` | `Promise<void>` | Closes the menu. Returns a promise that will resolve when the menu has closed. |
168-
| `toggleMenu()` | `Promise<void>` | Toggles the menu. Returns a promise that will resolve when the menu has completed opening or closing. |
169-
| `destroyMenu()` | `Promise<void>` | Destroys the menu overlay completely.
170-
168+
| `toggleMenu()` | `Promise<void>` | Toggles the menu. Returns a promise that will resolve when the menu has completed opening or closing. |
169+
| `destroyMenu()` | `Promise<void>` | Destroys the menu overlay completely.
170+
171171

src/lib/menu/menu-errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class MdMenuMissingError extends MdError {
1010
1111
Example:
1212
<md-menu #menu="mdMenu"></md-menu>
13-
<button [md-menu-trigger-for]="menu"></button>
13+
<button [mdMenuTriggerFor]="menu"></button>
1414
`);
1515
}
1616
}

src/lib/menu/menu-trigger.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {MenuPositionX, MenuPositionY} from './menu-positions';
3232
* responsible for toggling the display of the provided menu instance.
3333
*/
3434
@Directive({
35-
selector: '[md-menu-trigger-for], [mat-menu-trigger-for]',
35+
selector: '[md-menu-trigger-for], [mat-menu-trigger-for], [mdMenuTriggerFor]',
3636
host: {
3737
'aria-haspopup': 'true',
3838
'(mousedown)': '_handleMousedown($event)',
@@ -51,7 +51,7 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy {
5151
// the first item of the list when the menu is opened via the keyboard
5252
private _openedByMouse: boolean = false;
5353

54-
@Input('md-menu-trigger-for') menu: MdMenuPanel;
54+
@Input('mdMenuTriggerFor') menu: MdMenuPanel;
5555
@Output() onMenuOpen = new EventEmitter<void>();
5656
@Output() onMenuClose = new EventEmitter<void>();
5757

@@ -157,7 +157,7 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy {
157157

158158
/**
159159
* This method checks that a valid instance of MdMenu has been passed into
160-
* md-menu-trigger-for. If not, an exception is thrown.
160+
* mdMenuTriggerFor. If not, an exception is thrown.
161161
*/
162162
private _checkMenu() {
163163
if (!this.menu) {

src/lib/menu/menu.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ describe('MdMenu', () => {
284284

285285
@Component({
286286
template: `
287-
<button [md-menu-trigger-for]="menu" #triggerEl>Toggle menu</button>
287+
<button [mdMenuTriggerFor]="menu" #triggerEl>Toggle menu</button>
288288
<md-menu #menu="mdMenu">
289289
<button md-menu-item> Item </button>
290290
<button md-menu-item disabled> Disabled </button>
@@ -298,7 +298,7 @@ class SimpleMenu {
298298

299299
@Component({
300300
template: `
301-
<button [md-menu-trigger-for]="menu" #triggerEl>Toggle menu</button>
301+
<button [mdMenuTriggerFor]="menu" #triggerEl>Toggle menu</button>
302302
<md-menu x-position="before" y-position="above" #menu="mdMenu">
303303
<button md-menu-item> Positioned Content </button>
304304
</md-menu>
@@ -332,7 +332,7 @@ class CustomMenuPanel implements MdMenuPanel {
332332

333333
@Component({
334334
template: `
335-
<button [md-menu-trigger-for]="menu">Toggle menu</button>
335+
<button [mdMenuTriggerFor]="menu">Toggle menu</button>
336336
<custom-menu #menu="mdCustomMenu">
337337
<button md-menu-item> Custom Content </button>
338338
</custom-menu>

0 commit comments

Comments
 (0)