-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Sankey diagram * Update demo data * Update demo * Clean up * Fix tests
- Loading branch information
1 parent
2d72326
commit d9bf977
Showing
15 changed files
with
501 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
projects/swimlane/ngx-charts/src/lib/sankey/sankey.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { Component } from '@angular/core'; | ||
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | ||
|
||
import { APP_BASE_HREF } from '@angular/common'; | ||
|
||
import { SankeyModule } from './sankey.module'; | ||
|
||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; | ||
|
||
@Component({ | ||
selector: 'test-component', | ||
template: '' | ||
}) | ||
class TestComponent { | ||
colorScheme = { | ||
domain: ['#5AA454', '#A10A28', '#C7B42C', '#AAAAAA'] | ||
}; | ||
} | ||
|
||
describe('<ngx-charts-sankey>', () => { | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [TestComponent], | ||
imports: [NoopAnimationsModule, SankeyModule], | ||
providers: [{ provide: APP_BASE_HREF, useValue: '/' }] | ||
}); | ||
}); | ||
|
||
describe('basic setup', () => { | ||
beforeEach(() => { | ||
TestBed.overrideComponent(TestComponent, { | ||
set: { | ||
template: ` | ||
<ngx-charts-sankey | ||
[animations]="false" | ||
[view]="[400,800]" | ||
[scheme]="colorScheme" | ||
[results]="[ | ||
{ source: 'United States Of America', target: 'Japan', value: 50 }, | ||
{ source: 'Germany', target: 'Japan', value: 80 }, | ||
{ source: 'Germany', target: 'South Korea', value: 25 }, | ||
{ source: 'France', target: 'South Korea', value: 30 }, | ||
{ source: 'France', target: 'Italy', value: 10 }, | ||
{ source: 'France', target: 'North Macedonia', value: 15 }, | ||
{ source: 'India', target: 'Japan', value: 10 }, | ||
{ source: 'Japan', target: 'UK', value: 60 }, | ||
{ source: 'Japan', target: 'UK', value: 10 }, | ||
{ source: 'Japan', target: 'Democratic Republic of São Tomé and Príncipe', value: 50 }, | ||
{ source: 'Japan', target: 'Republic of Equatorial Guinea', value: 20 }, | ||
{ source: 'South Korea', target: 'UK', value: 55 }, | ||
{ source: 'Italy', target: 'UK', value: 10 }, | ||
{ source: 'North Macedonia', target: 'Republic of Equatorial Guinea', value: 15 }, | ||
{ source: 'UK', target: 'Independent and the Sovereign Republic of Kiribati', value: 10 }, | ||
{ source: 'UK', target: 'Commonwealth of the Northern Mariana Islands', value: 60 }, | ||
{ source: 'UK', target: 'Bosnia and Herzegovina', value: 25 }, | ||
{ source: 'UK', target: 'Spain', value: 20 }, | ||
{ source: 'UK', target: 'Bosnia and Herzegovina', value: 20 }, | ||
{ source: 'Republic of Equatorial Guinea', target: 'Republic of Costa Rica', value: 30 }, | ||
{ source: 'Republic of Equatorial Guinea', target: 'Portugal', value: 5 } | ||
]"> | ||
</ngx-charts-sankey>` | ||
} | ||
}).compileComponents(); | ||
}); | ||
|
||
it('should set the svg width and height', () => { | ||
const fixture = TestBed.createComponent(TestComponent); | ||
fixture.detectChanges(); | ||
|
||
const svg = fixture.debugElement.nativeElement.querySelector('svg'); | ||
|
||
expect(svg.getAttribute('width')).toBe('400'); | ||
expect(svg.getAttribute('height')).toBe('800'); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.