snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
This commit is contained in:
21
packages/css-supports/jest.config.ts
Normal file
21
packages/css-supports/jest.config.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import client from '@rocket.chat/jest-presets/client';
|
||||
import server from '@rocket.chat/jest-presets/server';
|
||||
import type { Config } from 'jest';
|
||||
|
||||
export default {
|
||||
projects: [
|
||||
{
|
||||
displayName: 'client',
|
||||
preset: client.preset,
|
||||
setupFilesAfterEnv: [...client.setupFilesAfterEnv],
|
||||
testMatch: ['<rootDir>/src/**/*.client.spec.[jt]s?(x)'],
|
||||
},
|
||||
{
|
||||
displayName: 'server',
|
||||
preset: server.preset,
|
||||
testMatch: ['<rootDir>/src/**/*.server.spec.[jt]s?(x)'],
|
||||
},
|
||||
],
|
||||
coverageProvider: 'v8',
|
||||
collectCoverage: true,
|
||||
} satisfies Config;
|
||||
48
packages/css-supports/package.json
Normal file
48
packages/css-supports/package.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "@rocket.chat/css-supports",
|
||||
"version": "0.31.25",
|
||||
"description": "Memoized and SSR-compatible facade of CSS.supports API",
|
||||
"bugs": {
|
||||
"url": "https://github.com/RocketChat/Rocket.Chat/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/RocketChat/Rocket.Chat.git",
|
||||
"directory": "packages/css-supports"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Rocket.Chat",
|
||||
"url": "https://rocket.chat/"
|
||||
},
|
||||
"main": "dist/cjs/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
"types": "dist/esm/index.d.ts",
|
||||
"files": [
|
||||
"/dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "rm -rf dist && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"test": "jest",
|
||||
"testunit": "jest",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@rocket.chat/memo": "workspace:~"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rocket.chat/jest-presets": "workspace:~",
|
||||
"@rocket.chat/tsconfig": "workspace:~",
|
||||
"eslint": "~9.39.5",
|
||||
"jest": "~30.2.0",
|
||||
"typescript": "~5.9.3"
|
||||
},
|
||||
"volta": {
|
||||
"extends": "../../package.json"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
61
packages/css-supports/src/index.client.spec.ts
Normal file
61
packages/css-supports/src/index.client.spec.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Runs in the `client` project, whose jsdom environment provides a `window` but no `CSS` object at
|
||||
* all, so a browser's `CSS.supports` is what the stub below stands in for.
|
||||
*
|
||||
* `cssSupports` picks its implementation when the module is first evaluated, so every case resets
|
||||
* the module registry and sets up `window.CSS` before importing.
|
||||
*/
|
||||
|
||||
const stubCSSSupports = (supports: (value: string) => boolean): void => {
|
||||
Object.defineProperty(window, 'CSS', {
|
||||
value: { supports },
|
||||
configurable: true,
|
||||
writable: true,
|
||||
});
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
Reflect.deleteProperty(window, 'CSS');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
Reflect.deleteProperty(window, 'CSS');
|
||||
});
|
||||
|
||||
describe('with no CSS.supports to delegate to', () => {
|
||||
it('should report every query as unsupported', async () => {
|
||||
expect(window.CSS).toBeUndefined();
|
||||
|
||||
const { cssSupports } = await import('./index');
|
||||
|
||||
expect(cssSupports('display:flex')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('with CSS.supports available', () => {
|
||||
it('should delegate the query and relay the answer', async () => {
|
||||
const supports = jest.fn((value: string) => value === 'display:flex');
|
||||
stubCSSSupports(supports);
|
||||
|
||||
const { cssSupports } = await import('./index');
|
||||
|
||||
expect(cssSupports('display:flex')).toBe(true);
|
||||
expect(cssSupports('display:grid')).toBe(false);
|
||||
expect(supports).toHaveBeenCalledWith('display:flex');
|
||||
expect(supports).toHaveBeenCalledWith('display:grid');
|
||||
});
|
||||
|
||||
it('should evaluate each distinct query only once', async () => {
|
||||
const supports = jest.fn(() => true);
|
||||
stubCSSSupports(supports);
|
||||
|
||||
const { cssSupports } = await import('./index');
|
||||
|
||||
cssSupports('display:flex');
|
||||
cssSupports('display:flex');
|
||||
cssSupports('display:grid');
|
||||
|
||||
expect(supports).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
||||
13
packages/css-supports/src/index.server.spec.ts
Normal file
13
packages/css-supports/src/index.server.spec.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Runs in the `server` project, whose environment has no `window` at all — the server-side
|
||||
* rendering path `cssSupports` has to survive.
|
||||
*/
|
||||
|
||||
it('should report every query as unsupported instead of throwing', async () => {
|
||||
expect(typeof window).toBe('undefined');
|
||||
|
||||
const { cssSupports } = await import('./index');
|
||||
|
||||
expect(cssSupports('display:flex')).toBe(false);
|
||||
expect(cssSupports('margin-inline-start:0')).toBe(false);
|
||||
});
|
||||
4
packages/css-supports/src/index.ts
Normal file
4
packages/css-supports/src/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { memoize } from '@rocket.chat/memo';
|
||||
|
||||
export const cssSupports: (value: string) => boolean =
|
||||
typeof window !== 'undefined' && window.CSS?.supports ? memoize((value: string) => window.CSS.supports(value)) : () => false;
|
||||
11
packages/css-supports/tsconfig.cjs.json
Normal file
11
packages/css-supports/tsconfig.cjs.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "./dist/cjs",
|
||||
"declaration": false,
|
||||
"declarationMap": false
|
||||
},
|
||||
"exclude": ["**/*.spec.ts", "jest.config.*"]
|
||||
}
|
||||
9
packages/css-supports/tsconfig.esm.json
Normal file
9
packages/css-supports/tsconfig.esm.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"outDir": "./dist/esm"
|
||||
},
|
||||
"exclude": ["**/*.spec.ts", "jest.config.*"]
|
||||
}
|
||||
8
packages/css-supports/tsconfig.json
Normal file
8
packages/css-supports/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "@rocket.chat/tsconfig/client.json",
|
||||
"compilerOptions": {
|
||||
"target": "es2024",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
Reference in New Issue
Block a user