Skip to content

Commit

Permalink
fix: migrate to aem.js (#87)
Browse files Browse the repository at this point in the history
* fix: migrate to aem.js

* fix: test

* fix: remove tests now covered in aem-lib repo
  • Loading branch information
dylandepass authored Oct 13, 2023
1 parent 64262c8 commit 2f2d0b5
Show file tree
Hide file tree
Showing 24 changed files with 475 additions and 555 deletions.
2 changes: 1 addition & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
name: '@storybook/addon-coverage',
options: {
istanbul: {
exclude: ['**/lib-franklin.js', '**/scripts.js']
exclude: ['**/aem.js', '**/scripts.js']
}
}
}, '@storybook/addon-mdx-gfm'],
Expand Down
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<meta property="og:title" content="Page not found">
<script src="/scripts/scripts.js" type="module" crossorigin="use-credentials"></script>
<script type="module">
import { sampleRUM } from '/scripts/lib-franklin.js';
import { sampleRUM } from '/scripts/aem.js';

window.addEventListener('load', () => {
if (document.referrer) {
Expand Down
4 changes: 2 additions & 2 deletions blocks/footer/footer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readBlockConfig, decorateIcons } from '../../scripts/lib-franklin.js';
import { createTag } from '../../scripts/scripts.js';
import { readBlockConfig } from '../../scripts/aem.js';
import { createTag, decorateIcons } from '../../scripts/scripts.js';

/**
* loads and decorates the footer
Expand Down
2 changes: 1 addition & 1 deletion blocks/footer/footer.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
buildBlock,
loadBlock,
decorateBlock,
} from '../../scripts/lib-franklin.js';
} from '../../scripts/aem.js';
import _style from './footer.css';
import { createTag } from '../../scripts/scripts.js';

Expand Down
4 changes: 2 additions & 2 deletions blocks/header/header.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readBlockConfig, decorateIcons } from '../../scripts/lib-franklin.js';
import { isMobile, createTag } from '../../scripts/scripts.js';
import { readBlockConfig } from '../../scripts/aem.js';
import { isMobile, createTag, decorateIcons } from '../../scripts/scripts.js';

/**
* collapses all open nav sections
Expand Down
2 changes: 1 addition & 1 deletion blocks/header/header.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
buildBlock,
loadBlock,
decorateBlock,
} from '../../scripts/lib-franklin.js';
} from '../../scripts/aem.js';
import _style from './header.css';
import { createTag } from '../../scripts/scripts.js';

Expand Down
2 changes: 1 addition & 1 deletion components/avatar/avatar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { loadCSS, toCamelCase } from '../../scripts/lib-franklin.js';
import { loadCSS, toCamelCase } from '../../scripts/aem.js';
import { createTag } from '../../scripts/scripts.js';

class Avatar extends HTMLElement {
Expand Down
4 changes: 2 additions & 2 deletions components/tag/tag.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { loadCSS, decorateIcons } from '../../scripts/lib-franklin.js';
import { createTag } from '../../scripts/scripts.js';
import { loadCSS } from '../../scripts/aem.js';
import { createTag, decorateIcons } from '../../scripts/scripts.js';

class Tag extends HTMLElement {
constructor() {
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/buttons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ To include an icon in a button you can use the `decorateIcons` function to decor
The HTMLElement above should then be passed into the `decorateIcons` function to load the icon inside the span. Below is a full example.

```javascript
import { decorateIcons } from 'lib-franklin.js';
import { decorateIcons } from 'scripts.js';

const container = document.createElement('p');
container.classList.add('button-container');
Expand Down
7 changes: 5 additions & 2 deletions docs/stories/components/buttons.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import { within, waitFor, userEvent } from '@storybook/testing-library';
import { expect } from '@storybook/jest';
import { FranklinTemplate } from '@dylandepass/franklin-storybook-addon';
import { decorateIcons } from '../../../scripts/lib-franklin.js';
import { createTag, loadPage } from '../../../scripts/scripts.js';
import { createTag, loadPage, decorateIcons } from '../../../scripts/scripts.js';

function decorate(block) {
decorateIcons(block);
Expand Down Expand Up @@ -76,6 +75,10 @@ export const AuthoredButtons = {
expect(canvas.getByText('Authored Buttons')).toBeInTheDocument();
});

await waitFor(() => {
expect(canvas.getByTitle('Primary')).toBeInTheDocument();
});

const primary = canvas.getByTitle('Primary');
expect(primary).toBeInTheDocument();

Expand Down
2 changes: 1 addition & 1 deletion head.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<script src="/scripts/lib-franklin.js" type="module"></script>
<script src="/scripts/aem.js" type="module"></script>
<script src="/scripts/scripts.js" type="module"></script>
<link id="theme" rel="stylesheet" href="/styles/themes/rosalind-light.css" />
<link rel="stylesheet" href="/styles/system.css">
Expand Down
Loading

0 comments on commit 2f2d0b5

Please sign in to comment.