Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0b443b9

Browse files
committed
Fixes#237. Adding strict- pattern to the PlotlyViaCDNModule.setPlotlyVersion method
1 parent435fd02 commit0b443b9

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

‎CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#Changelog
22

33

4+
##[5.1.1] - 2023-06-15
5+
###Changed
6+
- Adding support to strict version of bundle plotly (seehttps://github.com/plotly/angular-plotly.js/issues/237)
7+
48
##[5.1.0] - 2023-04-10
59
###Changed
610
- Updated to Angular 15

‎projects/plotly/src/lib/plotly-via-cdn.module.spec.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,31 @@ describe('PlotlyViaCDNModule', () => {
4545
});
4646

4747
it('should NOT set Plotly version',()=>{
48-
constversion="invalid";
48+
consterrorMsg="Invalid plotly version. Please set 'latest' or version number (i.e.: 1.4.3) or strict version number (i.e.: strict-1.4.3)";
4949
spyOn(PlotlyViaCDNModule,"loadViaCDN").and.callThrough();
5050

51-
expect(()=>{
52-
PlotlyViaCDNModule.setPlotlyVersion(version);
53-
}).toThrowError("Invalid plotly version. Please set 'latest' or version number (i.e.: 1.4.3)");
51+
letversion="invalid";
52+
expect(()=>{PlotlyViaCDNModule.setPlotlyVersion(version);}).toThrowError(errorMsg);
53+
54+
version="strict-1";
55+
expect(()=>{PlotlyViaCDNModule.setPlotlyVersion(version);}).toThrowError(errorMsg);
56+
57+
version="1";
58+
expect(()=>{PlotlyViaCDNModule.setPlotlyVersion(version);}).toThrowError(errorMsg);
59+
60+
version="strict-1.1.a";
61+
expect(()=>{PlotlyViaCDNModule.setPlotlyVersion(version);}).toThrowError(errorMsg);
62+
63+
version="strit-1.1.1";
64+
expect(()=>{PlotlyViaCDNModule.setPlotlyVersion(version);}).toThrowError(errorMsg);
65+
});
66+
67+
it('should allow Plotly version with strict- at the beginning',()=>{
68+
constversion="strict-2.24.1";
69+
spyOn(PlotlyViaCDNModule,"loadViaCDN");
70+
71+
PlotlyViaCDNModule.setPlotlyVersion(version);
72+
expect((PlotlyViaCDNModuleasany).plotlyVersion).toBe(version);
5473
});
5574
});
5675
});

‎projects/plotly/src/lib/plotly-via-cdn.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export class PlotlyViaCDNModule {
2424
}
2525

2626
publicstaticsetPlotlyVersion(version:string):void{
27-
constisOk=version==='latest'||/^\d\.\d{1,2}\.\d{1,2}$/.test(version);
27+
constisOk=version==='latest'||/^(strict-)?\d\.\d{1,2}\.\d{1,2}$/.test(version);
2828
if(!isOk){
29-
thrownewError(`Invalid plotly version. Please set 'latest' or version number (i.e.: 1.4.3)`);
29+
thrownewError(`Invalid plotly version. Please set 'latest' or version number (i.e.: 1.4.3) or strict version number (i.e.: strict-1.4.3)`);
3030
}
3131

3232
PlotlyViaCDNModule.loadViaCDN();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp