Skip to content

Commit

Permalink
Auto prettier/linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bjester committed May 23, 2024
1 parent b6fa89f commit cea58c6
Show file tree
Hide file tree
Showing 20 changed files with 50 additions and 32 deletions.
3 changes: 3 additions & 0 deletions docs/assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ code {

a code {
color: $link-color;

&:hover {
color: $link-hover-color;
}
Expand All @@ -44,6 +45,7 @@ a {

&:hover {
color: $link-hover-color;

svg {
fill: $link-hover-color;
}
Expand All @@ -70,6 +72,7 @@ html {
html {
box-sizing: border-box;
}

*,
*::before,
*::after {
Expand Down
1 change: 1 addition & 0 deletions docs/common/DocsFilter/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
font-size: 12px;
border: 1px solid $border-color;
border-radius: 4px;
&::placeholder {
color: $border-color;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/common/DocsPageTemplate/SideNav/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
return termList(this.filterText);
},
visibleTableOfContents() {
let toc = [];
const toc = [];
for (const section of tableOfContents) {
// if the section title matches, add the entire thing
if (matches(this.terms, section.title)) {
Expand Down
1 change: 1 addition & 0 deletions docs/pages/principles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
.description {
font-size: 18px;
}
li {
font-size: 14px;
color: #616161;
Expand Down
6 changes: 3 additions & 3 deletions lib/KDropdownMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@
const lastChild = menuElements[menuElements.length - 1];
const popoverIsOpen = popover.clientWidth > 0 && popover.clientHeight > 0;
// set current element and its siblings
let focusedElement = document.activeElement;
let sibling = focusedElement.nextElementSibling;
let prevSibling = focusedElement.previousElementSibling;
const focusedElement = document.activeElement;
const sibling = focusedElement.nextElementSibling;
const prevSibling = focusedElement.previousElementSibling;
// manage rotating through the options using arrow keys
// UP arrow: .keyCode is depricated and should used only as a fallback
Expand Down
20 changes: 11 additions & 9 deletions lib/KImg/__tests__/KImg.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('KImg', () => {
const error = jest.fn();
const wrapper = makeWrapper({
propsData: { src: '/le-logo.svg', altText: 'LE logo' },
listeners: { error }
listeners: { error },
});

expect(wrapper.exists()).toBe(true);
Expand All @@ -26,19 +26,21 @@ describe('KImg', () => {
const error = jest.fn();
makeWrapper({
propsData: { src: '/le-logo.svg', altText: undefined },
listeners: { error }
listeners: { error },
});
expect(error).toHaveBeenCalled();
expect(error.mock.calls[0][0]).toBeInstanceOf(Error);
expect(error.mock.calls[0][0].message).toBe("Missing required prop - provide altText or indicate isDecorative");
expect(error.mock.calls[0][0].message).toBe(
'Missing required prop - provide altText or indicate isDecorative'
);
});

describe(`when no 'altText' is provided and it is a decorative image`, () => {
it(`does not throw an error`, () => {
const error = jest.fn();
makeWrapper({
propsData: { src: '/le-logo.svg', altText: undefined, isDecorative: true },
listeners: { error }
listeners: { error },
});
expect(error).not.toHaveBeenCalled();
});
Expand All @@ -56,18 +58,18 @@ describe('KImg', () => {
const error = jest.fn();
makeWrapper({
propsData: { src: '/le-logo.svg', altText: 'LE logo', aspectRatio: '16/9' },
listeners: { error }
listeners: { error },
});
expect(error).toHaveBeenCalled();
expect(error.mock.calls[0][0]).toBeInstanceOf(Error);
expect(error.mock.calls[0][0].message).toBe("Invalid aspect ratio provided: 16/9");
expect(error.mock.calls[0][0].message).toBe('Invalid aspect ratio provided: 16/9');
});

it(`doesn't throw an error when 'aspectRatio' has a valid format`, () => {
const error = jest.fn();
makeWrapper({
propsData: { src: '/le-logo.svg', altText: 'LE logo', aspectRatio: '16:9' },
listeners: { error }
listeners: { error },
});
expect(error).not.toHaveBeenCalled();
});
Expand All @@ -76,15 +78,15 @@ describe('KImg', () => {
const error = jest.fn();
const wrapper = makeWrapper({
propsData: { src: '/le-logo.svg', altText: 'LE logo' },
listeners: { error }
listeners: { error },
});

// Manually trigger the onError method to simulate the image load failure
const e = new Event('error');
wrapper.vm.onError(e);

expect(error).toHaveBeenCalled();
expect(error.mock.calls[0][0]).toBeInstanceOf(Event)
expect(error.mock.calls[0][0]).toBeInstanceOf(Event);
expect(error.mock.calls[0][0]).toEqual(e);
});
});
6 changes: 3 additions & 3 deletions lib/KLabeledIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@
);
},
labelStyle() {
let styles = {};
const styles = {};
let margins = 0;
let leftLtr = this.isRtl ? 'marginRight' : 'marginLeft';
let rightLtr = this.isRtl ? 'marginLeft' : 'marginRight';
const leftLtr = this.isRtl ? 'marginRight' : 'marginLeft';
const rightLtr = this.isRtl ? 'marginLeft' : 'marginRight';
// Margin for icons - use em to match parent font size
if (this.iconAfter || this.$slots['iconAfter']) {
styles[rightLtr] = '1.975em'; // scale with parent font size
Expand Down
5 changes: 3 additions & 2 deletions lib/KModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@
}
.scroll-shadow {
background: linear-gradient(white 30%, hsla(0, 0%, 100%, 0)),
linear-gradient(hsla(0, 0%, 100%, 0) 10px, white 70%) bottom,
background: linear-gradient(white 30%, hsla(0deg, 0%, 100%, 0)),
linear-gradient(hsla(0deg, 0%, 100%, 0) 10px, white 70%) bottom,
radial-gradient(at top, rgba(0, 0, 0, 0.2), transparent 70%),
radial-gradient(at bottom, rgba(0, 0, 0, 0.2), transparent 70%) bottom;
background-repeat: no-repeat;
Expand All @@ -448,6 +448,7 @@
.actions {
padding: 24px;
text-align: right;
button {
margin: 0;
}
Expand Down
1 change: 1 addition & 0 deletions lib/KSelect/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,7 @@
&.is-active:not(.is-disabled) {
border-bottom-color: $ui-input-border-color--active;
.ui-icon {
color: $ui-input-icon-color--active;
}
Expand Down
3 changes: 3 additions & 0 deletions lib/KSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
cursor: default;
}
}
&.is-rtl {
direction: rtl;
}
Expand Down Expand Up @@ -265,6 +266,7 @@
transition-duration: 0.2s;
transition-property: background-color, transform;
}
.k-switch-label-text {
margin-left: 16px;
font-size: 15px;
Expand All @@ -290,6 +292,7 @@
.k-switch-track {
background-color: #b4c3fb;
}
.k-switch-thumb {
background-color: #4368f5;
}
Expand Down
1 change: 1 addition & 0 deletions lib/KTransition.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
.component-fade-leave-active {
transition: opacity 0.25s ease;
}
.component-fade-enter,
.component-fade-leave-to {
opacity: 0;
Expand Down
6 changes: 3 additions & 3 deletions lib/__tests__/KModal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('KModal component', () => {
});

it(`text should appear on the close button`, () => {
let cancelText = 'goodbye';
const cancelText = 'goodbye';
const onClick = jest.fn();
const wrapper = shallowMount(KModal, {
propsData: {
Expand All @@ -42,7 +42,7 @@ describe('KModal component', () => {
});

it(`submit button is disabled if submitDisabled is true`, () => {
let submitText = 'hello';
const submitText = 'hello';
const onClick = jest.fn();
const wrapper = shallowMount(KModal, {
propsData: {
Expand All @@ -55,7 +55,7 @@ describe('KModal component', () => {
});

it(`cancel button is disabled if cancelDisabled is true`, () => {
let cancelText = 'goodbye';
const cancelText = 'goodbye';
const onClick = jest.fn();
const wrapper = shallowMount(KModal, {
propsData: {
Expand Down
2 changes: 1 addition & 1 deletion lib/buttons-and-links/KButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
};
},
textStyle() {
let styles = {};
const styles = {};
if (this.icon) {
if (this.isRtl) {
// If RTL-language, but English link, displays correct margins
Expand Down
2 changes: 1 addition & 1 deletion lib/buttons-and-links/KExternalLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
* If link opens in new tab or if icon is provided, add 8px margin between the icon and the text
*/
spanStyle() {
let styles = {};
const styles = {};
if (this.openInNewTab || this.icon) {
if (this.isRtl) {
// If RTL-language, but English link, displays correct margins
Expand Down
2 changes: 1 addition & 1 deletion lib/buttons-and-links/KRouterLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
* If icon is provided, add 8px margin between the icon and the text
*/
spanStyle() {
let styles = {};
const styles = {};
if (this.icon) {
if (this.isRtl) {
// If RTL-language, but English link, displays correct margins
Expand Down
1 change: 1 addition & 0 deletions lib/loaders/KCircularLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
from {
opacity: 0;
}
to {
opacity: 1;
}
Expand Down
1 change: 1 addition & 0 deletions lib/loaders/KLinearLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
from {
opacity: 0;
}
to {
opacity: 1;
}
Expand Down
1 change: 1 addition & 0 deletions lib/styles/definitions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ $core-time: 0.25s;
.partial-fonts-loaded & {
font-family: 'noto-subset', 'noto-common', sans-serif;
}

.full-fonts-loaded & {
// Continue to include the common and subset font subsets since they may contain
// glyphs not available in the language's default font.
Expand Down
2 changes: 1 addition & 1 deletion lib/tabs/__tests__/KTabs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const TABS_WITH_ROUTES = [
// spec files where majority of tabs functionality is tested.
describe(`KTabs`, () => {
it(`smoke test`, () => {
const wrapper = shallowMount(KTabs, { listeners: { error: () => {}}});
const wrapper = shallowMount(KTabs, { listeners: { error: () => {} } });
expect(wrapper.exists()).toBeTruthy();
});

Expand Down
16 changes: 9 additions & 7 deletions lib/tabs/__tests__/KTabsList.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ const routerPush = router.push;
// @see https://github.com/vuejs/vue-router/issues/2881#issuecomment-520554378
router.push = function(location, onResolve, onReject) {
if (onResolve || onReject) {
return routerPush.call(this, location, onResolve, onReject)
return routerPush.call(this, location, onResolve, onReject);
}
return routerPush.call(this, location).catch((err) => {
return routerPush.call(this, location).catch(err => {
if (VueRouter.isNavigationFailure(err)) {
// resolve err
return err;
}
// rethrow error
return Promise.reject(err);
})
}
});
};

const TABS = [
{ id: 'tabLessons', label: 'Lessons' },
Expand All @@ -46,7 +46,7 @@ describe(`KTabsList`, () => {
router,
listeners: {
error: errorListener,
}
},
});
}

Expand All @@ -59,7 +59,7 @@ describe(`KTabsList`, () => {
});

it(`smoke test`, () => {
const wrapper = shallowMount(KTabsList, { listeners: { error: errorListener }});
const wrapper = shallowMount(KTabsList, { listeners: { error: errorListener } });
expect(wrapper.exists()).toBeTruthy();
});

Expand All @@ -74,7 +74,9 @@ describe(`KTabsList`, () => {
expect(errorListener).toHaveBeenCalled();
expect(errorListener).toHaveBeenCalledTimes(1);
expect(errorListener.mock.calls[0][0]).toBeInstanceOf(Error);
expect(errorListener.mock.calls[0][0].message).toBe(`[KTabsList] Missing 'ariaLabel' or 'ariaLabelledBy'`);
expect(errorListener.mock.calls[0][0].message).toBe(
`[KTabsList] Missing 'ariaLabel' or 'ariaLabelledBy'`
);
});

describe(`when 'ariaLabel' prop is provided`, () => {
Expand Down

0 comments on commit cea58c6

Please sign in to comment.