Skip to content

Commit

Permalink
Merge pull request #12178 from bbc/WSTEAM1-1408-add-lite-platforms-type
Browse files Browse the repository at this point in the history
WSTEAM1-1408: Populates 'x2' ATI value with 'lite' for .lite pages
  • Loading branch information
Isabella-Mitchell authored Nov 15, 2024
2 parents 220ad2d + 41c38b9 commit 2a7f864
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/contexts/RequestContext/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ describe('RequestContext', () => {
isAmp: false,
isApp: false,
isLite: true,
platform: 'canonical',
platform: 'lite',
});
});

Expand Down
2 changes: 2 additions & 0 deletions src/app/contexts/RequestContext/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export const RequestContextProvider = ({
return 'app';
case isAmp:
return 'amp';
case isLite:
return 'lite';
default:
return 'canonical';
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/lib/analyticsUtils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export const getAppType = platform => {
return 'amp';
case 'app':
return 'mobile-app';
case 'lite':
return 'lite';
case 'canonical':
return 'responsive';
default:
Expand Down
5 changes: 5 additions & 0 deletions src/app/lib/analyticsUtils/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ describe('getAppType', () => {
expected: 'mobile-app',
summary: 'should return mobile-app for app',
},
{
platform: 'lite',
expected: 'lite',
summary: 'should return lite for lite',
},
{
platform: 'canonical',
expected: 'responsive',
Expand Down
2 changes: 1 addition & 1 deletion src/app/models/types/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as PAGE_TYPES from '../../routes/utils/pageTypes';

export type Environments = 'local' | 'test' | 'live';

export type Platforms = 'amp' | 'canonical' | 'app';
export type Platforms = 'amp' | 'canonical' | 'app' | 'lite';

export type Direction = 'rtl' | 'ltr';

Expand Down
4 changes: 3 additions & 1 deletion src/integration/integrationTestEnvironment.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class IntegrationTestEnvironment extends JsdomEnvironment {
} = context.docblockPragmas;
const pageType = getPageTypeFromTestPath(context.testPath);

const platformForPath = platform === 'canonical' ? '' : `.${platform}`;
const platformForPath = ['amp', 'lite'].includes(platform)
? `.${platform}`
: '';

this.pageType = camelCaseToText(pageType);
this.service = service;
Expand Down

0 comments on commit 2a7f864

Please sign in to comment.