Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Handle styles for filedrop when links are not allowed #686

Merged
merged 2 commits into from
May 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/modules/fileattachments/file-drop.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="sky-file-drop-row">
<div class="sky-file-drop-row" [ngClass]="{'sky-file-drop-allow-links': allowLinks}">
<div class="sky-file-drop-col">
<button
type="button"
Expand Down
4 changes: 4 additions & 0 deletions src/modules/fileattachments/file-drop.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
}

.sky-file-drop-col {
flex-basis: 100%;
}

.sky-file-drop-allow-links.sky-file-drop-col {
flex-basis: 50%;
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/modules/fileattachments/file-drop.component.visual-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,15 @@ describe('File drop', function () {
selector: '#screenshot-file-drop'
});
});

it('should match the file drop control when no links allowed', function () {
return browser
.setupTest('/fileattachments.html')
.click('.sky-test-allow-links')
.pause(1000)
.compareScreenshot({
screenshotName: 'file_drop_nolink',
selector: '#screenshot-file-drop'
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@
(linkChanged)="linkAdded($event)"
[maxFileSize]="maxFileSize"
[validateFn]="validateFile"
[allowLinks]="true">
[allowLinks]="allowLinks">
</sky-file-drop>

<div *ngFor="let file of allItems">
<sky-file-item [fileItem]="file" (deleteFile)="deleteFile($event)"></sky-file-item>
</div>
</div>
</div>

<button
type="button"
class="sky-btn sky-btn-primary sky-test-allow-links"
(click)="allowLinks = !allowLinks">
Toggle allowLinks
</button>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class AppComponent {

public acceptedTypes: Array<String>;

public allowLinks: boolean = true;

constructor() {
this.filesToUpload = [];
this.rejectedFiles = [];
Expand Down