Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic working test #343

Merged
merged 1 commit into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { createElement } from 'lwc';
import MiscPermissionBasedUI from 'c/miscPermissionBasedUI';

describe('c-misc-permission-based-u-i', () => {
afterEach(() => {
// The jsdom instance is shared across test cases in a single file so reset the DOM
while (document.body.firstChild) {
document.body.removeChild(document.body.firstChild);
}
});

// This is a placeholder test that simulates the "assigned permission" behavior
// of this component. Currently exploring correct way to mock the permission
// values of true and undefined that are experienced at runtime.
it('displays the correct UI when custom permission is true', () => {
const element = createElement('c-misc-permission-based-u-i', {
is: MiscPermissionBasedUI
});
document.body.appendChild(element);

const pEl = element.shadowRoot.querySelector('p');
expect(pEl.textContent).toBe('The permission set is assigned');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</div>
<c-view-source source="lwc/miscPermissionBasedUI" slot="footer">
Use custom permission to conditionally render UI. To change the
rendered UI assign the
<strong>Access_Restricted_UI</strong> permission set to this user
and refresh the page.
rendered UI assign
the&nbsp;<strong>Access_Restricted_UI</strong>&nbsp;permission set
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A suggestion to avoid hard-coding escape characters would be to use the prettier-ignore comment option on the outer div, see example implementation here.

to this user and refresh the page.
</c-view-source>
</lightning-card>
</template>