Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(file-input): introducing file-input component. (closes #326) and (closes #286) #339

Merged
merged 35 commits into from
Feb 22, 2017

Conversation

emoralesb05
Copy link
Contributor

@emoralesb05 emoralesb05 commented Feb 14, 2017

Description

Removed the file-selection part out of file-upload to create an atomic component thats able to be used stand-alone or part of file-upload.
#326 and #286

What's included?

  • td-file-input component for stand-alone usage with ngModel support.
<td-file-input [(ngModel)]="files" color="primary" (select)="selectEvent($event)" accept=".ext,.anotherExt" [disabled]="disabled" multiple>
  <md-icon>attach_file</md-icon><span>Choose a file...</span>
</td-file-input>
<td-file-upload #singleFileUpload (select)="selectEvent($event)" (upload)="uploadEvent($event)" [disabled]="disabled">
    <md-icon>file_upload</md-icon><span>{{ singleFileUpload.files?.name }}</span>
    <template td-file-input-label>
      <md-icon>attach_file</md-icon><span>Choose a file...</span>
    </template>
  </td-file-upload>
  • docs(file-upload): updated README.md for td-file-upload and load it as part of the docs.
  • docs(file-upload): updated demo for td-file-upload with better examples.
  • feature(file-upload): add (select) event to td-file-upload component.
  • performance(file-upload): add OnPush change detection. [Performance] Make sure all our elements work under OnPush. #325

Test Steps

General Tests for Every PR

  • ng serve --aot still works.
  • npm run lint passes.
  • npm test passes and code coverage is not lower.
  • npm run build still works.
Screenshots or link to CodePen/Plunker/JSfiddle

@emoralesb05 emoralesb05 changed the title feature(file-input): introducing file-input component. (closes #326) feature(file-input): introducing file-input component. (closes #326) and (closes #286) Feb 15, 2017
@ilsiepotamus
Copy link
Contributor

screen shot 2017-02-22 at 1 05 44 pm

text does not disappear after a file is selected

@emoralesb05
Copy link
Contributor Author

Thats an issue from material when using [value] which is fixed in their beta.2.

@ilsiepotamus ilsiepotamus self-requested a review February 22, 2017 19:12
@richavyas
Copy link
Collaborator

file-input-ui-distort

@richavyas
Copy link
Collaborator

drop-file-ui-distort

Copy link
Collaborator

@richavyas richavyas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UI gets distorted when one or more than one files are dropped or uploaded.

it('should mimic file selection and then clear it',
async(inject([], () => {
let fixture: ComponentFixture<any> = TestBed.createComponent(TdFileUploadBasicTestComponent);
let component: TdFileUploadBasicTestComponent = fixture.debugElement.componentInstance;
component.multiple = false;
fixture.detectChanges();
fixture.whenStable().then(() => {
expect(fixture.debugElement.query(By.css('.td-file-browse'))).toBeTruthy();
expect(fixture.debugElement.query(By.css('td-file-input'))).toBeTruthy();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can tags be called by By.css or it should be By.directive? or were you actually calling it on class: td-file-input and missed the dot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By.css doesnt literally mean it needs to be a class. It just means it can be a css selector, which in this case is an element selector.

@richavyas richavyas merged commit c91d3cd into develop Feb 22, 2017
@richavyas richavyas deleted the feature/file-browse branch February 22, 2017 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants