mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 05:58:26 +08:00
ci: add CodeQL workflow (#25443)
Co-authored-by: Liam DeBeasi <liamdebeasi@icloud.com>
This commit is contained in:
21
.github/workflows/codeql-analysis.yml
vendored
Normal file
21
.github/workflows/codeql-analysis.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
name: CodeQL
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
security-events: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: javascript
|
||||
- uses: github/codeql-action/analyze@v2
|
@ -253,7 +253,7 @@ export class Platform {
|
||||
}
|
||||
|
||||
const readQueryParam = (url: string, key: string) => {
|
||||
key = key.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
|
||||
key = key.replace(/[[\]\\]/g, '\\$&');
|
||||
const regex = new RegExp('[\\?&]' + key + '=([^&#]*)');
|
||||
const results = regex.exec(url);
|
||||
return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null;
|
||||
|
@ -13,6 +13,7 @@ describe('Providers', () => {
|
||||
cy.get('#is-desktop').should('have.text', 'true');
|
||||
cy.get('#is-mobile').should('have.text', 'false');
|
||||
cy.get('#keyboard-height').should('have.text', '12345');
|
||||
cy.get('#query-params').should('have.text', 'firstParam: null, firstParam: null');
|
||||
});
|
||||
|
||||
it('should detect testing mode', () => {
|
||||
@ -20,5 +21,11 @@ describe('Providers', () => {
|
||||
|
||||
cy.get('#is-testing').should('have.text', 'true');
|
||||
});
|
||||
|
||||
it('should get query params', () => {
|
||||
cy.visit('/providers?firstParam=abc&secondParam=true');
|
||||
|
||||
cy.get('#query-params').should('have.text', 'firstParam: abc, firstParam: true');
|
||||
})
|
||||
});
|
||||
|
||||
|
@ -33,4 +33,7 @@
|
||||
<p>
|
||||
keyboardHeight: <span id="keyboard-height">{{keyboardHeight}}</span>
|
||||
</p>
|
||||
<p>
|
||||
queryParams: <span id="query-params">{{queryParams}}</span>
|
||||
</p>
|
||||
</ion-content>
|
||||
|
@ -20,6 +20,7 @@ export class ProvidersComponent {
|
||||
isDesktop: boolean = undefined;
|
||||
isMobile: boolean = undefined;
|
||||
keyboardHeight = 0;
|
||||
queryParams = '';
|
||||
|
||||
constructor(
|
||||
actionSheetCtrl: ActionSheetController,
|
||||
@ -64,6 +65,10 @@ export class ProvidersComponent {
|
||||
NgZone.assertInAngularZone();
|
||||
this.isResized = true;
|
||||
});
|
||||
const firstQuery = platform.getQueryParam('firstParam');
|
||||
const secondQuery = platform.getQueryParam('secondParam');
|
||||
this.queryParams = `firstParam: ${firstQuery}, firstParam: ${secondQuery}`;
|
||||
|
||||
this.isDesktop = platform.is('desktop');
|
||||
this.isMobile = platform.is('mobile');
|
||||
|
||||
|
Reference in New Issue
Block a user