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

chore: Remove jest dependencies #10301

Merged
merged 4 commits into from
Oct 20, 2024
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
15 changes: 0 additions & 15 deletions templates/jest.config.js

This file was deleted.

18 changes: 9 additions & 9 deletions templates/modern/src/docfx.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ $container-max-widths: (
xxl: 1768px
) !default;

@import "mixins";
@import "bootstrap/scss/bootstrap";
@import "highlight";
@import "layout";
@import "nav";
@import "toc";
@import "markdown";
@import "search";
@import "dotnet";
@use "mixins";
@use "bootstrap/scss/bootstrap";
@use "highlight";
@use "layout";
@use "nav";
@use "toc";
@use "markdown";
@use "search";
@use "dotnet";

h1,
h2,
Expand Down
30 changes: 16 additions & 14 deletions templates/modern/src/helper.test.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

import test from 'node:test'
import assert from 'node:assert'
import { breakWord, isSameURL } from './helper'

test('break text', () => {
expect(breakWord('Other APIs')).toEqual(['Other APIs'])
expect(breakWord('System.CodeDom')).toEqual(['System.', 'Code', 'Dom'])
expect(breakWord('System.Collections.Dictionary<string, object>')).toEqual(['System.', 'Collections.', 'Dictionary<', 'string,', ' object>'])
expect(breakWord('https://github.com/dotnet/docfx')).toEqual(['https://github.', 'com/', 'dotnet/', 'docfx'])
assert.deepStrictEqual(breakWord('Other APIs'), ['Other APIs'])
assert.deepStrictEqual(breakWord('System.CodeDom'), ['System.', 'Code', 'Dom'])
assert.deepStrictEqual(breakWord('System.Collections.Dictionary<string, object>'), ['System.', 'Collections.', 'Dictionary<', 'string,', ' object>'])
assert.deepStrictEqual(breakWord('https://github.com/dotnet/docfx'), ['https://github.', 'com/', 'dotnet/', 'docfx'])
})

test('is same URL', () => {
expect(isSameURL({ pathname: '/' }, { pathname: '/' })).toBeTruthy()
expect(isSameURL({ pathname: '/index.html' }, { pathname: '/' })).toBeTruthy()
expect(isSameURL({ pathname: '/a/index.html' }, { pathname: '/a' })).toBeTruthy()
expect(isSameURL({ pathname: '/a/index.html' }, { pathname: '/a/' })).toBeTruthy()
expect(isSameURL({ pathname: '/a' }, { pathname: '/a/' })).toBeTruthy()
expect(isSameURL({ pathname: '/a/foo.html' }, { pathname: '/a/foo' })).toBeTruthy()
expect(isSameURL({ pathname: '/a/foo/' }, { pathname: '/a/foo' })).toBeTruthy()
expect(isSameURL({ pathname: '/a/foo/index.html' }, { pathname: '/a/foo' })).toBeTruthy()
expect(isSameURL({ pathname: '/a/index.html' }, { pathname: '/A/Index.html' })).toBeTruthy()
assert.ok(isSameURL({ pathname: '/' }, { pathname: '/' }))
assert.ok(isSameURL({ pathname: '/index.html' }, { pathname: '/' }))
assert.ok(isSameURL({ pathname: '/a/index.html' }, { pathname: '/a' }))
assert.ok(isSameURL({ pathname: '/a/index.html' }, { pathname: '/a/' }))
assert.ok(isSameURL({ pathname: '/a' }, { pathname: '/a/' }))
assert.ok(isSameURL({ pathname: '/a/foo.html' }, { pathname: '/a/foo' }))
assert.ok(isSameURL({ pathname: '/a/foo/' }, { pathname: '/a/foo' }))
assert.ok(isSameURL({ pathname: '/a/foo/index.html' }, { pathname: '/a/foo' }))
assert.ok(isSameURL({ pathname: '/a/index.html' }, { pathname: '/A/Index.html' }))

expect(isSameURL({ pathname: '/a/foo/index.html' }, { pathname: '/a/bar' })).toBeFalsy()
assert.ok(!isSameURL({ pathname: '/a/foo/index.html' }, { pathname: '/a/bar' }))
})
10 changes: 6 additions & 4 deletions templates/modern/src/highlight.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
* The .NET Foundation licenses this file to you under the MIT license.
*/

@import "highlight.js/scss/vs";
@use "sass:meta";
@use "highlight.js/scss/vs";
@use "bootstrap/scss/bootstrap";

@include color-mode(dark) {
@include bootstrap.color-mode(dark) {
/* stylelint-disable-next-line no-invalid-position-at-import-rule */
@import "highlight.js/scss/vs2015";
@include meta.load-css("highlight.js/scss/vs2015");
}

.hljs {
Expand All @@ -24,7 +26,7 @@ pre > code .line-highlight {
background-color: yellow;
}

@include color-mode(dark) {
@include bootstrap.color-mode(dark) {
pre > code .line-highlight {
background-color: #4a4a00;
}
Expand Down
19 changes: 12 additions & 7 deletions templates/modern/src/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
* The .NET Foundation licenses this file to you under the MIT license.
*/

@use "bootstrap/scss/bootstrap";

$header-height: 60px;
$footer-height: 60px;
$main-padding-top: 1.6rem;
$main-padding-bottom: 2rem;

// Makes a div sticky to top
@mixin sticky-top {
@include media-breakpoint-up(md) {
@include bootstrap.media-breakpoint-up(md) {
position: sticky;
top: 0;
z-index: 1030;
}
}

@mixin stick-to-header {
@include media-breakpoint-up(md) {
@include bootstrap.media-breakpoint-up(md) {
position: sticky;
top: calc($header-height + $main-padding-top);
}
Expand All @@ -43,7 +45,7 @@ body[data-layout="landing"] {

@include sticky-top;

@include media-breakpoint-up(md) {
@include bootstrap.media-breakpoint-up(md) {
height: $header-height;
}

Expand Down Expand Up @@ -82,7 +84,7 @@ body[data-layout="landing"] {
flex: 1;
}

@include media-breakpoint-up(md) {
@include bootstrap.media-breakpoint-up(md) {
>article [id] {
scroll-margin-top: $header-height;
}
Expand Down Expand Up @@ -140,7 +142,7 @@ body[data-layout="landing"] {

@include stick-to-header;

@include media-breakpoint-down(md) {
@include bootstrap.media-breakpoint-down(md) {
flex: 0;
}

Expand Down Expand Up @@ -177,11 +179,11 @@ body[data-layout="landing"] {
display: flex;
}

@include media-breakpoint-down(lg) {
@include bootstrap.media-breakpoint-down(lg) {
margin: 0 1rem;
}

@include media-breakpoint-down(md) {
@include bootstrap.media-breakpoint-down(md) {
margin: 0;
}
}
Expand All @@ -190,7 +192,10 @@ body[data-layout="landing"] {
display: block;
width: 230px;
max-height: calc(100vh - $header-height - $main-padding-top);

/* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */
overflow-x: hidden;
/* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */
overflow-y: auto;

@include stick-to-header;
Expand Down
11 changes: 7 additions & 4 deletions templates/modern/src/markdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* The .NET Foundation licenses this file to you under the MIT license.
*/

@use "bootstrap/scss/bootstrap";
@use "mixins";

/* External link icon */
a.external[href]::after {
font-family: bootstrap-icons;
Expand All @@ -16,15 +19,15 @@ a.external[href]::after {
blockquote {
border-style: solid;
border-width: 0 0 0 3px;
border-color: $secondary-border-subtle;
border-color: bootstrap.$secondary-border-subtle;
margin: 1.2em 0 2em;
padding: 0 .8em;
display: block
}

@include color-mode(dark) {
@include bootstrap.color-mode(dark) {
blockquote {
border-color: $secondary-border-subtle-dark;
border-color: bootstrap.$secondary-border-subtle-dark;
}
}

Expand All @@ -39,7 +42,7 @@ blockquote {
font-size: 1rem;

&::before {
@include adjust-icon;
@include mixins.adjust-icon;
}
}

Expand Down
13 changes: 8 additions & 5 deletions templates/modern/src/nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
* The .NET Foundation licenses this file to you under the MIT license.
*/

@use "bootstrap/scss/bootstrap";
@use "mixins";

.breadcrumb {
font-size: 14px;

a {
@include underline-on-hover;
@include mixins.underline-on-hover;
}
}

Expand Down Expand Up @@ -84,7 +87,7 @@
}
}

@include media-breakpoint-down(md) {
@include bootstrap.media-breakpoint-down(md) {
#navbar {
flex-direction: column;
align-items: flex-start;
Expand Down Expand Up @@ -137,7 +140,7 @@
margin: .4rem 0;

a {
@include underline-on-hover;
@include mixins.underline-on-hover;
}
}
}
Expand All @@ -147,13 +150,13 @@
margin-top: 2rem;

a.edit-link {
@include underline-on-hover;
@include mixins.underline-on-hover;

&::before {
content: "\F4CA";
display: inline-block;

@include adjust-icon;
@include mixins.adjust-icon;
}
}
}
4 changes: 3 additions & 1 deletion templates/modern/src/search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
* The .NET Foundation licenses this file to you under the MIT license.
*/

@use "bootstrap/scss/bootstrap";

#search-results {
line-height: 1.8;

>.search-list {
font-size: .9em;
color: $secondary;
color: bootstrap.$secondary;
}

>.sr-items {
Expand Down
11 changes: 7 additions & 4 deletions templates/modern/src/toc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* The .NET Foundation licenses this file to you under the MIT license.
*/

@use "bootstrap/scss/bootstrap";
@use "mixins";

$expand-stub-width: .85rem;

.toc {
Expand Down Expand Up @@ -30,7 +33,7 @@ $expand-stub-width: .85rem;
li > a {
display: inline;

@include underline-on-hover;
@include mixins.underline-on-hover;
}

li > ul {
Expand Down Expand Up @@ -90,17 +93,17 @@ $expand-stub-width: .85rem;

>.no-result {
font-size: .9em;
color: $secondary;
color: bootstrap.$secondary;
}

a.pdf-link {
@include underline-on-hover;
@include mixins.underline-on-hover;

&::before {
content: "\F756";
display: inline-block;

@include adjust-icon;
@include mixins.adjust-icon;
}
}
}
Loading