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

feat(stark-ui): example Viewer + basic showcase layout #480

Merged
merged 1 commit into from
Jul 4, 2018

Conversation

catlabs
Copy link
Contributor

@catlabs catlabs commented Jul 3, 2018

ISSUES CLOSED: #458, #459

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

  • Add a basic layout for the showcase in order to add components in it while we are developing the.
  • Create the example viewer component, which takes extension and files path as Input and display the existing files

Issue Number: #458, #459

@dsebastien
Copy link
Contributor

Should be okay with the missing show as script added back!

LGTM!

Copy link
Collaborator

@christophercr christophercr left a comment

Choose a reason for hiding this comment

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

Just some small changes.

Apart from that, the build in Travis failed due to this issue:

"ERROR in : Couldn't resolve resource button-types-example.css relative to /home/travis/build/NationalBankBelgium/stark/showcase/src/assets/examples/test.ts"

You can check it here: https://travis-ci.org/NationalBankBelgium/stark/jobs/399592862

{ name: "index", url: "/", component: HomeComponent },
{ name: "home", url: "/home", component: HomeComponent },
{ name: "home", url: "/", component: HomeComponent },
{ name: "demo-exemple-viewer", url: "/demo-exemple-viewer", component: DemoComponent },
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo: "exemple" => "example"

export class ExampleViewerService {
public constructor(private http: HttpClient) {}

public fetchFileAlt(path: string): Observable<string> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question... Why does the name of this method ends with "Alt" ? Perhaps is simpler to call it fetchFile() only.

import { Observable } from "rxjs";

@Injectable()
export class ExampleViewerService {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we can rename this service to something more generic that really describes what it does: fetching files.

I know this service is only used by the example viewer component for now but maybe we can use it later for other components/features.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, maybe we can call it FileService, so we could extend it easier if we want to add other methods linked to file manipulation

});
});

describe("example-viewer-service", () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test suite ("describe" block) does not belong here. This spec.ts file are only related to the example viewer component.

The tests related to the service should be in a different spec.ts file ;)

});
});

describe("@Input() extensions", () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's put all the describe blocks related to inputs at the top and the rest of tests after so we can have more or less a convention on how to structure our unit tests ;)

export function highlightJsFactory(): any {
return hljs;
}
fdescribe("ExampleViewerComponent", () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't forget to remove the "f" before the "describe", otherwise only this test will be executed in Travis!!

MatTabsModule,
CommonModule
],
providers: [],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question, isn't the service to fetch the files supposed to be included in here? I think it has not been defined in any module right? or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn t make any difference for now but true it is more correct to provide it

@catlabs catlabs force-pushed the feature/showcase branch from 6796ad0 to 8986eb3 Compare July 4, 2018 08:07
@catlabs catlabs force-pushed the feature/showcase branch from 8986eb3 to ff675c8 Compare July 4, 2018 09:14
@coveralls
Copy link

coveralls commented Jul 4, 2018

Coverage Status

Coverage decreased (-0.01%) to 95.447% when pulling ff675c8 on catlabs:feature/showcase into d2c36cd on NationalBankBelgium:master.

.fetchFile("/assets/examples/" + this.filesPath + "." + extension.toLowerCase())
.subscribe(
(data: string) => this.addFileContent({ extension: extension, file: data }),
(error: HttpErrorResponse) => console.log(error)
Copy link
Collaborator

@christophercr christophercr Jul 4, 2018

Choose a reason for hiding this comment

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

One small change: just replace this console.log by the StarkLogging service

Normally we should always use the StarkLogging service. We should use console In case it is not possible to use the Stark service or it is really necessary.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Finally we'll leave the console in there because there is an issue with the Stark mocks. Tracked in #484

@christophercr christophercr merged commit 9c3453d into NationalBankBelgium:master Jul 4, 2018
@catlabs catlabs deleted the feature/showcase branch July 17, 2018 12:32
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.

showcase: layout skeleton
4 participants