From e8adde9e25f0e578eace12cb25115d7830b6b86b Mon Sep 17 00:00:00 2001
From: domsteinbach <36757218+domsteinbach@users.noreply.github.com>
Date: Thu, 11 Aug 2022 14:07:08 +0200
Subject: [PATCH] feat(document): make changes to text component (DEV-1147)
(#791)
* feat(document): change style for text viewer
* feat(document): change style for text viewer
* chore: change typo in comment
* fest(menu): add css classes
* fest(menu): add css classes
* refactor(text icon): Change text icon to text_snippet
* refactor(tests): remove tests for button
* refactor: add needed import of MatMenu to the spec
* refactor(tests): change imports
---
.../archive/archive.component.html | 4 +-
.../representation/text/text.component.html | 40 ++++++++++++++-----
.../representation/text/text.component.scss | 36 +++++++++++++++++
.../text/text.component.spec.ts | 20 ++--------
4 files changed, 72 insertions(+), 28 deletions(-)
diff --git a/src/app/workspace/resource/representation/archive/archive.component.html b/src/app/workspace/resource/representation/archive/archive.component.html
index 8e9b86bddf..f5ae10a307 100644
--- a/src/app/workspace/resource/representation/archive/archive.component.html
+++ b/src/app/workspace/resource/representation/archive/archive.component.html
@@ -19,7 +19,7 @@
diff --git a/src/app/workspace/resource/representation/text/text.component.html b/src/app/workspace/resource/representation/text/text.component.html
index 3fb79443af..f7a642550f 100644
--- a/src/app/workspace/resource/representation/text/text.component.html
+++ b/src/app/workspace/resource/representation/text/text.component.html
@@ -2,15 +2,37 @@
-
-
+
+
+
+
+
+ text_snippet
+
+
+
+
+
+
+
No valid file url found for this resource.
diff --git a/src/app/workspace/resource/representation/text/text.component.scss b/src/app/workspace/resource/representation/text/text.component.scss
index e69de29bb2..86762ed978 100644
--- a/src/app/workspace/resource/representation/text/text.component.scss
+++ b/src/app/workspace/resource/representation/text/text.component.scss
@@ -0,0 +1,36 @@
+@import "../../../../../assets/style/responsive";
+@import "../../../../../assets/style/config";
+
+.file-representation {
+ width: 100%;
+
+ .container {
+ background: #292929;
+ border-radius: 8px 8px 0px 0px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ padding: 15.5% 0%;
+
+ .contents {
+ color: #FFFFFF;
+
+ .icon {
+ mat-icon {
+ height: 90px;
+ width: 90px;
+ font-size: 90px;
+ line-height: 90px;
+ }
+ }
+ }
+ }
+}
+
+
+::ng-deep .mat-menu-custom-black {
+ background: #292929;
+ .menu-content {
+ color: #FFFFFF;
+ }
+}
diff --git a/src/app/workspace/resource/representation/text/text.component.spec.ts b/src/app/workspace/resource/representation/text/text.component.spec.ts
index 260edd2c21..3e743254f7 100644
--- a/src/app/workspace/resource/representation/text/text.component.spec.ts
+++ b/src/app/workspace/resource/representation/text/text.component.spec.ts
@@ -3,7 +3,6 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { Component, OnInit, ViewChild } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { MatButtonHarness } from '@angular/material/button/testing';
import { MatDialogModule } from '@angular/material/dialog';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { KnoraApiConnection } from '@dasch-swiss/dsp-js';
@@ -13,6 +12,7 @@ import { TestConfig } from 'test.config';
import { FileRepresentation } from '../file-representation';
import { TextComponent } from './text.component';
+import { MatMenuModule } from '@angular/material/menu';
const textFileValue = {
'arkUrl': 'http://0.0.0.0:3336/ark:/72163/1/9876/=wcU1HzYTEKbJCYPybyKmAs/Kp81r_BPTHKa4oSd5iIxXgd',
@@ -63,7 +63,8 @@ describe('TextComponent', () => {
imports: [
HttpClientTestingModule,
MatDialogModule,
- MatSnackBarModule
+ MatSnackBarModule,
+ MatMenuModule
],
providers: [
AppInitService,
@@ -91,19 +92,4 @@ describe('TextComponent', () => {
it('should have a file url', () => {
expect(testHostComponent.textFileRepresentation.fileValue.fileUrl).toEqual('http://0.0.0.0:1024/9876/Jjic1ixccX7-BUHCAFNlEts.txt/file');
});
-
- it('should show a download button if the file url is provided', async () => {
- const downloadButtonElement = await loader.getHarness(MatButtonHarness.with({ selector: '.download' }));
-
- expect(downloadButtonElement).toBeTruthy();
- });
-
- it('should NOT show a download button if the file url is NOT provided', async () => {
- testHostComponent.textFileRepresentation = undefined;
- testHostFixture.detectChanges();
-
- const downloadButtonElement = await loader.getAllHarnesses(MatButtonHarness.with({ selector: '.download' }));
-
- expect(downloadButtonElement.length).toEqual(0);
- });
});