-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d078b2
commit 0d69f14
Showing
168 changed files
with
11,408 additions
and
4,310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
const path = require("path"); | ||
|
||
const basePath = path.resolve(__dirname); | ||
|
||
const commonChromeFlags = [ | ||
"--no-default-browser-check", | ||
"--no-first-run", | ||
"--no-sandbox", | ||
"--no-managed-user-acknowledgment-check", | ||
"--disable-background-timer-throttling", | ||
"--disable-backing-store-limit", | ||
"--disable-boot-animation", | ||
"--disable-cloud-import", | ||
"--disable-contextual-search", | ||
"--disable-default-apps", | ||
"--disable-extensions", | ||
"--disable-infobars", | ||
"--disable-translate", | ||
]; | ||
|
||
module.exports = function (config) { | ||
let browsers; | ||
if (process.env.BROWSERS) { | ||
browsers = [process.env.BROWSERS]; | ||
} else if (config.browsers) { | ||
browsers = config.browsers; | ||
} else { | ||
browsers = ["Chrome"]; | ||
} | ||
|
||
const setup = "setup-browser" + (config.package ? "-" + config.package : ""); | ||
const options = { | ||
basePath, | ||
browserDisconnectTimeout: 10000, | ||
processKillTimeout: 10000, | ||
frameworks: ["source-map-support", "mocha"], | ||
plugins: [ | ||
require("karma-mocha"), | ||
require("karma-mocha-reporter"), | ||
require("karma-webpack"), | ||
require("karma-source-map-support"), | ||
require("karma-sourcemap-loader"), | ||
require("karma-coverage-istanbul-reporter"), | ||
require("karma-chrome-launcher"), | ||
require("karma-firefox-launcher"), | ||
], | ||
files: [`dist/esm/__test__/${setup}.js`], | ||
preprocessors: { | ||
[`dist/esm/__test__/${setup}.js`]: ["webpack", "sourcemap"], | ||
}, | ||
webpackMiddleware: { | ||
// webpack-dev-middleware configuration | ||
// i. e. | ||
stats: "errors-only", | ||
}, | ||
webpack: { | ||
mode: "none", | ||
resolve: { | ||
extensions: [".js"], | ||
modules: ["dist", "node_modules"], | ||
mainFields: ["module", "main"], | ||
}, | ||
devtool: "inline-source-map", | ||
performance: { | ||
hints: false, | ||
}, | ||
optimization: { | ||
namedModules: false, | ||
namedChunks: false, | ||
nodeEnv: false, | ||
usedExports: true, | ||
flagIncludedChunks: false, | ||
occurrenceOrder: false, | ||
sideEffects: true, | ||
concatenateModules: true, | ||
splitChunks: { | ||
name: false, | ||
}, | ||
runtimeChunk: false, | ||
noEmitOnErrors: false, | ||
checkWasmTypes: false, | ||
minimize: false, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js\.map$/, | ||
use: ["ignore-loader"], | ||
}, | ||
{ | ||
test: /\.js$/, | ||
use: [ | ||
{ | ||
loader: "source-map-loader", | ||
options: { | ||
enforce: "pre", | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
mime: { | ||
"text/x-typescript": ["ts"], | ||
}, | ||
reporters: [config.reporter || (process.env.CI ? "min" : "progress")], | ||
browsers: browsers, | ||
customLaunchers: { | ||
ChromeDebugging: { | ||
base: "Chrome", | ||
flags: [...commonChromeFlags, "--remote-debugging-port=9333"], | ||
debug: true, | ||
}, | ||
ChromeHeadlessOpt: { | ||
base: "ChromeHeadless", | ||
flags: [...commonChromeFlags], | ||
}, | ||
}, | ||
client: { | ||
captureConsole: true, | ||
mocha: { | ||
bail: config["bail"], | ||
ui: "bdd", | ||
timeout: 5000, | ||
}, | ||
}, | ||
logLevel: config.LOG_ERROR, // to disable the WARN 404 for image requests | ||
}; | ||
|
||
if (config.coverage) { | ||
options.webpack.module.rules.push({ | ||
enforce: "post", | ||
exclude: /(__tests__|testing|node_modules|\.spec\.[tj]s$)/, | ||
loader: "istanbul-instrumenter-loader", | ||
options: { esModules: true }, | ||
test: /\.[tj]s$/, | ||
}); | ||
options.reporters = ["coverage-istanbul", ...options.reporters]; | ||
options.coverageIstanbulReporter = { | ||
reports: ["html", "text-summary", "json", "lcovonly", "cobertura"], | ||
dir: "coverage", | ||
}; | ||
options.junitReporter = { | ||
outputDir: "coverage", | ||
outputFile: "test-results.xml", | ||
useBrowserName: false, | ||
}; | ||
} | ||
|
||
config.set(options); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function importAll(r: __WebpackModuleApi.RequireContext): void { | ||
r.keys().forEach(r); | ||
} | ||
|
||
// Explicitly add to browser test | ||
importAll(require.context("../", true, /\.spec\.js$/)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-disable */ | ||
if (window.document && !window.document.createRange) { | ||
window.document.createRange = () => ({ | ||
setStart: () => {}, | ||
setEnd: () => {}, | ||
// @ts-ignore | ||
commonAncestorContainer: { | ||
nodeName: "BODY", | ||
ownerDocument: document, | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { css, ElementStyles } from "@microsoft/fast-element"; | ||
import { display, FoundationElementTemplate } from "@microsoft/fast-foundation"; | ||
import { | ||
bodyFont, | ||
neutralForegroundRest, | ||
neutralStrokeDividerRest, | ||
strokeWidth, | ||
typeRampMinus1FontSize, | ||
typeRampMinus1LineHeight, | ||
} from "../design-tokens.js"; | ||
|
||
/** | ||
* Styles for Accordion | ||
* @public | ||
*/ | ||
export const accordionStyles: FoundationElementTemplate<ElementStyles> = ( | ||
context, | ||
definition | ||
) => | ||
css` | ||
${display("flex")} :host { | ||
box-sizing: border-box; | ||
flex-direction: column; | ||
font-family: ${bodyFont}; | ||
font-size: ${typeRampMinus1FontSize}; | ||
line-height: ${typeRampMinus1LineHeight}; | ||
color: ${neutralForegroundRest}; | ||
border-top: calc(${strokeWidth} * 1px) solid ${neutralStrokeDividerRest}; | ||
} | ||
`; |
Oops, something went wrong.