Skip to content

Commit

Permalink
feat(compatibility): remove conflicts with material1 css styling (#2790)
Browse files Browse the repository at this point in the history
* feat(compatibility): remove conflicts with material1 css styling

* fix tests

* fix input changes

* autocomplete changes

* merge changes

* change class assignment to evaluation

* add back in the line truncate for select

* fix button on simple snackbar

* fix tests
  • Loading branch information
andrewseguin authored and tinayuangao committed Feb 8, 2017
1 parent 4b830d3 commit 210ff02
Show file tree
Hide file tree
Showing 186 changed files with 2,529 additions and 2,134 deletions.
22 changes: 11 additions & 11 deletions CODING_STANDARDS.md
Expand Up @@ -43,8 +43,8 @@ if (!$attrs['tabindex']) {
For example, rather than doing this:
```html
<md-button>Basic button</md-button>
<md-button class="md-fab">FAB</md-button>
<md-button class="md-icon-button">pony</md-button>
<md-button class="mat-fab">FAB</md-button>
<md-button class="mat-icon-button">pony</md-button>
```

do this:
Expand Down Expand Up @@ -192,13 +192,13 @@ code organization.** This will allow users to much more easily override styles.

For example, rather than doing this:
```scss
md-calendar {
.mat-calendar {
display: block;

.md-month {
.mat-month {
display: inline-block;

.md-date.md-selected {
.mat-date.mat-selected {
font-weight: bold;
}
}
Expand All @@ -207,15 +207,15 @@ md-calendar {

do this:
```scss
md-calendar {
.mat-calendar {
display: block;
}

.md-calendar-month {
.mat-calendar-month {
display: inline-block;
}

.md-calendar-date.md-selected {
.mat-calendar-date.mat-selected {
font-weight: bold;
}
```
Expand Down Expand Up @@ -260,11 +260,11 @@ This is a low-effort task that makes a big difference for low-vision users. Exam
When it is not super obvious, include a brief description of what a class represents. For example:
```scss
// The calendar icon button used to open the calendar pane.
.md-datepicker-button { ... }
.mat-datepicker-button { ... }

// Floating pane that contains the calendar at the bottom of the input.
.md-datepicker-calendar-pane { ... }
.mat-datepicker-calendar-pane { ... }

// Portion of the floating panel that sits, invisibly, on top of the input.
.md-datepicker-input-mask { }
.mat-datepicker-input-mask { }
```
8 changes: 4 additions & 4 deletions e2e/components/menu/menu-page.ts
Expand Up @@ -3,7 +3,7 @@ import {browser, by, element, ElementFinder} from 'protractor';
export class MenuPage {
constructor() { browser.get('/menu'); }

menu(): ElementFinder { return element(by.css('.md-menu-panel')); }
menu(): ElementFinder { return element(by.css('.mat-menu-panel')); }

start(): ElementFinder { return element(by.id('start')); }

Expand All @@ -23,11 +23,11 @@ export class MenuPage {

combinedTrigger(): ElementFinder { return element(by.id('combined-t')); }

beforeMenu(): ElementFinder { return element(by.css('.md-menu-panel.before')); }
beforeMenu(): ElementFinder { return element(by.css('.mat-menu-panel.before')); }

aboveMenu(): ElementFinder { return element(by.css('.md-menu-panel.above')); }
aboveMenu(): ElementFinder { return element(by.css('.mat-menu-panel.above')); }

combinedMenu(): ElementFinder { return element(by.css('.md-menu-panel.combined')); }
combinedMenu(): ElementFinder { return element(by.css('.mat-menu-panel.combined')); }

getResultText() { return this.textArea().getText(); }
}
4 changes: 2 additions & 2 deletions e2e/components/menu/menu.e2e.ts
Expand Up @@ -4,7 +4,7 @@ import {expectToExist, expectAlignedWith, expectFocusOn, expectLocation} from '.
import {pressKeys} from '../../util/actions';

describe('menu', () => {
const menuSelector = '.md-menu-panel';
const menuSelector = '.mat-menu-panel';
let page: MenuPage;

beforeEach(() => page = new MenuPage());
Expand Down Expand Up @@ -60,7 +60,7 @@ describe('menu', () => {
it('should mirror classes on host to menu template in overlay', () => {
page.trigger().click();
page.menu().getAttribute('class').then((classes: string) => {
expect(classes).toContain('md-menu-panel custom');
expect(classes).toContain('mat-menu-panel custom');
});
});

Expand Down
8 changes: 4 additions & 4 deletions e2e/components/radio/radio.e2e.ts
Expand Up @@ -7,7 +7,7 @@ describe('radio', () => {
it('should be checked when clicked', () => {
element(by.id('water')).click();
element(by.id('water')).getAttribute('class').then((value: string) => {
expect(value).toContain('md-radio-checked');
expect(value).toContain('mat-radio-checked');
});
element(by.css('input[id=water-input]')).getAttribute('checked').then((value: string) => {
expect(value).toBeTruthy();
Expand All @@ -18,7 +18,7 @@ describe('radio', () => {

element(by.id('leaf')).click();
element(by.id('leaf')).getAttribute('class').then((value: string) => {
expect(value).toContain('md-radio-checked');
expect(value).toContain('mat-radio-checked');
});
element(by.css('input[id=leaf-input]')).getAttribute('checked').then((value: string) => {
expect(value).toBeTruthy();
Expand All @@ -32,15 +32,15 @@ describe('radio', () => {
element(by.id('toggle-disable')).click();
element(by.id('water')).click();
element(by.id('water')).getAttribute('class').then((value: string) => {
expect(value).toContain('md-radio-disabled');
expect(value).toContain('mat-radio-disabled');
});
element(by.css('input[id=water-input]')).getAttribute('disabled').then((value: string) => {
expect(value).toBeTruthy();
});

element(by.id('leaf')).click();
element(by.id('leaf')).getAttribute('class').then((value: string) => {
expect(value).toContain('md-radio-disabled');
expect(value).toContain('mat-radio-disabled');
});
element(by.css('input[id=leaf-input]')).getAttribute('disabled').then((value: string) => {
expect(value).toBeTruthy();
Expand Down
2 changes: 1 addition & 1 deletion e2e/components/slide-toggle/slide-toggle.e2e.ts
Expand Up @@ -43,7 +43,7 @@ describe('slide-toggle', () => {

it('should move the thumb on state change', () => {
let slideToggleEl = getNormalToggle();
let thumbEl = element(by.css('#normal-slide-toggle .md-slide-toggle-thumb-container'));
let thumbEl = element(by.css('#normal-slide-toggle .mat-slide-toggle-thumb-container'));

let previousX = thumbEl.getLocation().then(pos => pos.x);

Expand Down
6 changes: 3 additions & 3 deletions e2e/components/tabs/tabs.e2e.ts
Expand Up @@ -10,7 +10,7 @@ describe('tabs', () => {
beforeEach(() => {
browser.get('/tabs');
tabGroup = element(by.css('md-tab-group'));
tabLabels = element.all(by.css('.md-tab-label'));
tabLabels = element.all(by.css('.mat-tab-label'));
tabBodies = element.all(by.css('md-tab-body'));
});

Expand Down Expand Up @@ -67,12 +67,12 @@ function getFocusStates(elements: ElementArrayFinder) {

/** Returns an array of true/false that represents the active states for the provided elements. */
function getLabelActiveStates(elements: ElementArrayFinder) {
return getClassStates(elements, 'md-tab-label-active');
return getClassStates(elements, 'mat-tab-label-active');
}

/** Returns an array of true/false that represents the active states for the provided elements */
function getBodyActiveStates(elements: ElementArrayFinder) {
return getClassStates(elements, 'md-tab-body-active');
return getClassStates(elements, 'mat-tab-body-active');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/demo-app/autocomplete/autocomplete-demo.scss
Expand Up @@ -2,12 +2,12 @@
display: flex;
flex-flow: row wrap;

md-card {
.mat-card {
width: 400px;
margin: 24px;
}

md-input-container {
.mat-input-container {
margin-top: 16px;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/demo-app/baseline/baseline-demo.scss
Expand Up @@ -2,7 +2,7 @@
.demo-basic {
padding: 0;
}
.demo-basic md-card-content {
.demo-basic .mat-card-content {
padding: 16px;
}
.demo-full-width {
Expand Down
2 changes: 1 addition & 1 deletion src/demo-app/card/card-demo.html
Expand Up @@ -51,7 +51,7 @@
</md-card-content>
</md-card>

<md-card class="demo-card-blue md-card-flat">
<md-card class="demo-card-blue mat-card-flat">
<md-card-title>Easily customizable</md-card-title>
<md-card-actions>
<button md-button>First</button>
Expand Down
4 changes: 2 additions & 2 deletions src/demo-app/card/card-demo.scss
Expand Up @@ -2,7 +2,7 @@
display: flex;
flex-flow: column nowrap;

md-card {
.mat-card {
margin: 0 16px 16px 0;
width: 350px;
}
Expand All @@ -15,7 +15,7 @@
.demo-card-blue {
background-color: #b0becc;

md-card-actions {
.mat-card-actions {
display: flex;
flex-direction: column;
}
Expand Down
2 changes: 1 addition & 1 deletion src/demo-app/chips/chips-demo.html
Expand Up @@ -54,7 +54,7 @@ <h4>Stacked Chips</h4>
<code>(focus)</code> event to run custom code.
</p>

<md-chip-list class="md-chip-list-stacked">
<md-chip-list class="mat-chip-list-stacked">
<md-chip *ngFor="let aColor of availableColors"
(focus)="color = aColor.color" color="{{aColor.color}}" selected="true">
{{aColor.name}}
Expand Down
10 changes: 5 additions & 5 deletions src/demo-app/chips/chips-demo.scss
@@ -1,23 +1,23 @@
.chips-demo {
.md-chip-list-stacked {
.mat-chip-list-stacked {
display: block;
max-width: 200px;
}

md-card {
.mat-card {
padding: 0;
margin: 16px;

& md-toolbar {
& .mat-toolbar {
margin: 0;
}

& md-card-content {
& .mat-card-content {
padding: 24px;
}
}

.md-basic-chip {
.mat-basic-chip {
margin: auto 10px;
}
}
8 changes: 4 additions & 4 deletions src/demo-app/demo-app/demo-app.scss
Expand Up @@ -8,10 +8,10 @@ body {
-moz-osx-font-smoothing: grayscale;
}

md-sidenav {
.mat-sidenav {
min-width: 15%;

[md-button] {
.mat-button {
width: 100%;
position: relative;
bottom: 0;
Expand All @@ -24,8 +24,8 @@ body {
box-sizing: border-box;
}

md-toolbar {
md-icon {
.mat-toolbar {
.mat-icon {
cursor: pointer;
}

Expand Down
4 changes: 2 additions & 2 deletions src/demo-app/grid-list/grid-list-demo.scss
@@ -1,15 +1,15 @@
.demo-grid-list {
width: 1100px;

md-card {
.mat-card {
margin: 16px 0;
}

p {
margin: 16px;
}

.demo-basic-list md-grid-tile {
.demo-basic-list .mat-grid-tile {
background: rgba(0, 0, 0, 0.32);
}

Expand Down
2 changes: 1 addition & 1 deletion src/demo-app/icon/icon-demo.scss
@@ -1,3 +1,3 @@
.demo-icon md-icon.green {
.demo-icon .mat-icon.green {
color: green;
}
2 changes: 1 addition & 1 deletion src/demo-app/input/input-container-demo.scss
@@ -1,7 +1,7 @@
.demo-basic {
padding: 0;
}
.demo-basic md-card-content {
.demo-basic .mat-card-content {
padding: 16px;
}
.demo-full-width {
Expand Down
6 changes: 3 additions & 3 deletions src/demo-app/list/list-demo.scss
Expand Up @@ -3,7 +3,7 @@
display: flex;
flex-flow: row wrap;

md-list, md-nav-list {
.mat-list, .mat-nav-list {
border: 1px solid rgba(0, 0, 0, 0.12);
width: 350px;
margin: 20px 20px 0 0;
Expand All @@ -13,11 +13,11 @@
margin-top: 20px;
}

md-icon {
.mat-icon {
color: rgba(0, 0, 0, 0.12);
}

[md-list-icon] {
.mat-list-icon {
color: white;
background: rgba(0, 0, 0, 0.3);
}
Expand Down
2 changes: 1 addition & 1 deletion src/demo-app/progress-spinner/progress-spinner-demo.html
Expand Up @@ -2,7 +2,7 @@ <h1>Determinate</h1>
<div class="demo-progress-spinner">
<md-progress-spinner mode="determinate"
[value]="progressValue"
class="md-primary"></md-progress-spinner>
class="mat-primary"></md-progress-spinner>
<md-progress-spinner [value]="progressValue"
color="accent"></md-progress-spinner>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/demo-app/progress-spinner/progress-spinner-demo.scss
@@ -1,8 +1,8 @@
.demo-progress-spinner {
width: 100%;

md-progress-spinner,
md-spinner {
.mat-progress-spinner,
.mat-spinner {
display: inline-block;
}

Expand Down
2 changes: 1 addition & 1 deletion src/demo-app/radio/radio-demo.scss
Expand Up @@ -8,7 +8,7 @@
margin: 8px;
padding: 16px;

md-radio-button {
.mat-radio-button {
margin: 8px;
}
}
2 changes: 1 addition & 1 deletion src/demo-app/select/select-demo.scss
Expand Up @@ -2,7 +2,7 @@
display: flex;
flex-flow: row wrap;

md-card {
.mat-card {
width: 450px;
margin: 24px;
}
Expand Down
4 changes: 2 additions & 2 deletions src/demo-app/sidenav/sidenav-demo.html
Expand Up @@ -31,8 +31,8 @@ <h1>My Content</h1>
</div>

<button md-button>HELLO</button>
<button md-raised-button class="md-primary">HELLO</button>
<button md-fab class="md-accent">HI</button>
<button md-raised-button class="mat-primary">HELLO</button>
<button md-fab class="mat-accent">HI</button>
</div>
</md-sidenav-container>

Expand Down
2 changes: 1 addition & 1 deletion src/demo-app/sidenav/sidenav-demo.scss
@@ -1,7 +1,7 @@
.demo-sidenav-container {
border: 3px solid black;

.md-sidenav-focus-trap > .cdk-focus-trap-content {
.mat-sidenav-focus-trap > .cdk-focus-trap-content {
padding: 10px;
}
}
Expand Down

0 comments on commit 210ff02

Please sign in to comment.