Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
liamwhite committed May 4, 2024
2 parents 887535b + 852f870 commit 8e0a1e3
Show file tree
Hide file tree
Showing 40 changed files with 3,317 additions and 7,696 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ npm-debug.log
/native/**/target
/.cargo

# Jest coverage
# Vitest coverage
/assets/coverage
3 changes: 1 addition & 2 deletions assets/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
js/vendor/*
webpack.config.js
jest.config.js
vite.config.ts
8 changes: 5 additions & 3 deletions assets/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ parserOptions:

plugins:
- '@typescript-eslint'
- jest
- vitest

globals:
ga: false
Expand Down Expand Up @@ -276,12 +276,14 @@ overrides:
'@typescript-eslint/no-extra-parens': 2
no-shadow: 0
'@typescript-eslint/no-shadow': 2
# Jest Tests (also written in TypeScript)
# Unit Tests (also written in TypeScript)
# Disable rules that do not make sense in test files (e.g. testing for undefined input values should be allowed)
- files:
- '*.spec.ts'
- 'test/*.ts'
extends:
- 'plugin:jest/recommended'
- 'plugin:vitest/legacy-recommended'
rules:
no-undefined: 0
no-unused-expressions: 0
vitest/valid-expect: 0
54 changes: 27 additions & 27 deletions assets/css/common/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
@import "global";

// Because FA is a SPECIAL SNOWFLAKE.
$fa-font-path: '~@fortawesome/fontawesome-free/webfonts';
$fa-font-path: '@fortawesome/fontawesome-free/webfonts';

@import "~@fortawesome/fontawesome-free/scss/fontawesome.scss";
@import "~@fortawesome/fontawesome-free/scss/solid.scss";
@import "~@fortawesome/fontawesome-free/scss/regular.scss";
@import "~@fortawesome/fontawesome-free/scss/brands.scss";
@import "~normalize-scss/sass/normalize/import-now";
@import "@fortawesome/fontawesome-free/scss/fontawesome.scss";
@import "@fortawesome/fontawesome-free/scss/solid.scss";
@import "@fortawesome/fontawesome-free/scss/regular.scss";
@import "@fortawesome/fontawesome-free/scss/brands.scss";
@import "normalize-scss/sass/normalize/import-now";

body {
background-color: $background_color;
Expand Down Expand Up @@ -469,27 +469,27 @@ span.stat {
@import "shame";
@import "text";

@import "~views/adverts";
@import "~views/approval";
@import "~views/badges";
@import "~views/channels";
@import "~views/comments";
@import "~views/commissions";
@import "~views/communications";
@import "~views/duplicate_reports";
@import "~views/filters";
@import "~views/galleries";
@import "~views/game";
@import "~views/images";
@import "~views/pages";
@import "~views/polls";
@import "~views/posts";
@import "~views/profiles";
@import "~views/pagination";
@import "~views/search";
@import "~views/staff";
@import "~views/stats";
@import "~views/tags";
@import "views/adverts";
@import "views/approval";
@import "views/badges";
@import "views/channels";
@import "views/comments";
@import "views/commissions";
@import "views/communications";
@import "views/duplicate_reports";
@import "views/filters";
@import "views/galleries";
@import "view/game";
@import "views/images";
@import "views/pages";
@import "views/polls";
@import "views/posts";
@import "views/profiles";
@import "views/pagination";
@import "views/search";
@import "views/staff";
@import "views/stats";
@import "views/tags";

.no-overflow {
overflow: hidden;
Expand Down
1 change: 1 addition & 0 deletions assets/css/common/_blocks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ a.block__header--single-item, .block__header a {
@extend .block__header--light;
background: transparent;
display: flex;
flex-wrap: wrap;

border-bottom: $border;
a {
Expand Down
2 changes: 1 addition & 1 deletion assets/css/themes/dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,4 @@ $dnp_warning_hover_color: lighten($vote_down_color, 10%);
$poll_form_label_background: lighten($border_color, 8);
$tag_dropdown_hover_background: darken($meta_color, 4%);

@import "~common/base";
@import "common/base";
2 changes: 1 addition & 1 deletion assets/css/themes/default.scss
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ $dnp_warning_hover_color: lighten($vote_down_color, 10%);
$poll_form_label_background: lighten($border_color, 8);
$tag_dropdown_hover_background: darken($meta_color, 4%);

@import "~common/base";
@import "common/base";
2 changes: 1 addition & 1 deletion assets/css/themes/red.scss
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,4 @@ $dnp_warning_hover_color: lighten($vote_down_color, 10%);
$poll_form_label_background: lighten($border_color, 8);
$tag_dropdown_hover_background: darken($meta_color, 4%);

@import "~common/base";
@import "common/base";
13 changes: 0 additions & 13 deletions assets/fix-jsdom.ts

This file was deleted.

42 changes: 0 additions & 42 deletions assets/jest.config.js

This file was deleted.

17 changes: 9 additions & 8 deletions assets/js/__tests__/input-duplicator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { inputDuplicatorCreator } from '../input-duplicator';
import { assertNotNull } from '../utils/assert';
import { $, $$, removeEl } from '../utils/dom';
import { fireEvent } from '@testing-library/dom';

describe('Input duplicator functionality', () => {
beforeEach(() => {
Expand Down Expand Up @@ -41,7 +42,7 @@ describe('Input duplicator functionality', () => {

expect($$('input')).toHaveLength(1);

assertNotNull($<HTMLButtonElement>('.js-add-input')).click();
fireEvent.click(assertNotNull($<HTMLButtonElement>('.js-add-input')));

expect($$('input')).toHaveLength(2);
});
Expand All @@ -53,7 +54,7 @@ describe('Input duplicator functionality', () => {
form.insertAdjacentElement('afterbegin', buttonDiv);
runCreator();

assertNotNull($<HTMLButtonElement>('.js-add-input')).click();
fireEvent.click(assertNotNull($<HTMLButtonElement>('.js-add-input')));

expect($$('input')).toHaveLength(2);
});
Expand All @@ -62,7 +63,7 @@ describe('Input duplicator functionality', () => {
runCreator();

for (let i = 0; i < 5; i += 1) {
assertNotNull($<HTMLButtonElement>('.js-add-input')).click();
fireEvent.click(assertNotNull($<HTMLButtonElement>('.js-add-input')));
}

expect($$('input')).toHaveLength(3);
Expand All @@ -71,19 +72,19 @@ describe('Input duplicator functionality', () => {
it('should remove duplicated input elements', () => {
runCreator();

assertNotNull($<HTMLButtonElement>('.js-add-input')).click();
assertNotNull($<HTMLAnchorElement>('.js-remove-input')).click();
fireEvent.click(assertNotNull($<HTMLButtonElement>('.js-add-input')));
fireEvent.click(assertNotNull($<HTMLAnchorElement>('.js-remove-input')));

expect($$('input')).toHaveLength(1);
});

it('should not remove the last input element', () => {
runCreator();

assertNotNull($<HTMLAnchorElement>('.js-remove-input')).click();
assertNotNull($<HTMLAnchorElement>('.js-remove-input')).click();
fireEvent.click(assertNotNull($<HTMLAnchorElement>('.js-remove-input')));
fireEvent.click(assertNotNull($<HTMLAnchorElement>('.js-remove-input')));
for (let i = 0; i < 5; i += 1) {
assertNotNull($<HTMLAnchorElement>('.js-remove-input')).click();
fireEvent.click(assertNotNull($<HTMLAnchorElement>('.js-remove-input')));
}

expect($$('input')).toHaveLength(1);
Expand Down
Loading

0 comments on commit 8e0a1e3

Please sign in to comment.