Skip to content

Conversation

@jake-bassett
Copy link
Contributor

Description

This adds a summary list component that can be used to list out labelled data.

A few other miscellaneous things (bad, Jake!):

  • Added two icons for internal and external
  • Fixed bands to draw behind series on cartesians
  • Re-ordered components public-api

@jake-bassett jake-bassett requested a review from a team as a code owner March 19, 2021 00:25
@codecov
Copy link

codecov bot commented Mar 19, 2021

Codecov Report

Merging #706 (843d189) into main (6b9c8d6) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #706      +/-   ##
==========================================
+ Coverage   85.15%   85.17%   +0.01%     
==========================================
  Files         782      784       +2     
  Lines       16036    16057      +21     
  Branches     2046     2047       +1     
==========================================
+ Hits        13656    13677      +21     
  Misses       2347     2347              
  Partials       33       33              
Impacted Files Coverage Δ
...ts/assets-library/src/icons/icon-library.module.ts 100.00% <ø> (ø)
...d/components/cartesian/d3/chart/cartesian-chart.ts 71.00% <ø> (ø)
projects/components/src/public-api.ts 100.00% <100.00%> (ø)
...ponents/src/summary-list/summary-list.component.ts 100.00% <100.00%> (ø)
...components/src/summary-list/summary-list.module.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b9c8d6...843d189. Read the comment docs.

@github-actions

This comment has been minimized.

@anandtiwary
Copy link
Contributor

Could you please share the screenshot?

import { SummaryItem } from './summary-list-api';

@Component({
selector: 'ht-summary-list',
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't love the name (when do I ever?). We already have a list-view, card-list, summary-values, table - so from the names, it's not clear how this one is different and when to use which.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I was scanning through our components and thinking the same thing. Open to suggestions. :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, of course - my own words turned against me. In that case, carry on.

@github-actions

This comment has been minimized.


public getFormattedLabel(item: SummaryItem): string {
return startCase(item.label.trim().replace('-', ' ').replace('_', ' ').toLowerCase());
return startCase(item.label.trim().toLowerCase());
Copy link
Contributor

Choose a reason for hiding this comment

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

trim is definitely still taken care of by startCase, the most intelligent of all cases. lower case may not be though.

Copy link
Contributor

@aaron-steinfeld aaron-steinfeld left a comment

Choose a reason for hiding this comment

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

Please add a test for the new component, hopefully someone can come up with a more inspired name in the meantime and if not we'll go with this.

@github-actions

This comment has been minimized.

let spectator: Spectator<SummaryListComponent>;

const createComponent = createComponentFactory({
component: SummaryListComponent,
Copy link
Contributor

Choose a reason for hiding this comment

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

For a component with inputs and ouputs, using a hostfactory allows you to provide inputs and then verify it rendered correctly. This test only verifies the logic directly rather than for a given set of inputs it renders the html we want - that's what we're generally looking for in a component's tests - the functions are implementation details.

@github-actions

This comment has been minimized.

expect(spectator.component.getValuesArray(true)).toEqual([true]);
expect(spectator.component.getValuesArray([true, false])).toEqual([true, false]);
const values = spectator.queryAll('li').map(e => e.textContent);
expect(values).toEqual(['0', '0', '1', '2', 'zero', 'zero', 'one', 'two', 'three', 'true', 'true', 'false']);
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was worth updating this test just to see that video.

@github-actions

This comment has been minimized.

@jake-bassett jake-bassett merged commit e260a6a into main Mar 22, 2021
@jake-bassett jake-bassett deleted the summary-list-component branch March 22, 2021 23:44
@github-actions
Copy link

Unit Test Results

    4 files  ±0  245 suites  +1   14m 24s ⏱️ +46s
878 tests +3  878 ✔️ +3  0 💤 ±0  0 ❌ ±0 
882 runs  +3  882 ✔️ +3  0 💤 ±0  0 ❌ ±0 

Results for commit e260a6a. ± Comparison against base commit 6b9c8d6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants