-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from scalprum/api-updates
fix(core): ensure scalprum instance receives configuration updates
- Loading branch information
Showing
8 changed files
with
76 additions
and
6 deletions.
There are no files selected for viewing
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,17 @@ | ||
describe('Scalprum API', () => { | ||
beforeEach(() => { | ||
cy.handleMetaError(); | ||
}); | ||
|
||
it('should display values from scalprum API', () => { | ||
cy.visit('http://localhost:4200/api'); | ||
cy.contains('API consumer isBeta: false').should('exist'); | ||
}); | ||
|
||
it('should update isBeta value', () => { | ||
cy.visit('http://localhost:4200/api'); | ||
cy.contains('API consumer isBeta: false').should('exist'); | ||
cy.contains('Toggle isBeta').click(); | ||
cy.contains('API consumer isBeta: true').should('exist'); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Box, Typography } from '@mui/material'; | ||
import { ScalprumComponent } from '@scalprum/react-core'; | ||
|
||
const ApiUpdates = () => { | ||
return ( | ||
<Box> | ||
<Typography variant="h4">API Updates</Typography> | ||
<Box sx={{ display: 'flex', justifyContent: 'space-between' }}> | ||
<Box> | ||
<ScalprumComponent module="./ApiModule" scope="sdk-plugin" importName="ApiConsumer" /> | ||
</Box> | ||
<Box> | ||
<ScalprumComponent module="./ApiModule" scope="sdk-plugin" importName="ApiChanger" /> | ||
</Box> | ||
</Box> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default ApiUpdates; |
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,12 @@ | ||
import React from 'react'; | ||
import { useScalprum } from '@scalprum/react-core'; | ||
|
||
export const ApiConsumer = () => { | ||
const { api } = useScalprum(); | ||
return <div>API consumer isBeta: {`${api.chrome.isBeta()}`}</div>; | ||
} | ||
|
||
export const ApiChanger = () => { | ||
const { api } = useScalprum(); | ||
return <div>API changer: <button onClick={() => api.chrome.setIsBeta((prev) => !prev)}>Toggle isBeta</button></div>; | ||
} |
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