Skip to content
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"scripts": {
"test": "node --test --import ./tests/register-stubs.mjs tests/*.test.js",
"build": "npm run build:iife && npm run build:esm",
"build": "rm -rf dist && npm run build:iife && npm run build:esm",
"build:iife": "esbuild src/index.js --bundle --format=iife --global-name=LearnosityWProofreader '--footer:js=LearnosityWProofreader=LearnosityWProofreader.LearnosityWProofreader;' --minify --outfile=dist/wproofreader-learnosity.min.js",
"build:esm": "esbuild src/index.js --bundle --format=esm --minify --outfile=dist/wproofreader-learnosity.esm.js",
"prepack": "npm run build"
Expand Down
4 changes: 1 addition & 3 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ export const SURFACE_GLOBALS = {
// explicitly with `surfaces: ['questions', 'items', 'author']`.
export const DEFAULT_SURFACES = ['author'];

// Fixed partner tag so WebSpellChecker can attribute traffic to this plugin
// (cf. the CKEditor 5 plugin's `proofreader_ck5`). Not caller-configurable.
export const APP_TYPE = 'wpr_learnosity';
export const APP_TYPE = 'learnosity_extension';

/*
* Split options into the WProofreader block (forwarded to the SDK's init()
Expand Down
6 changes: 3 additions & 3 deletions tests/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('serviceId path: Cloud config with grammar/autocorrect/appType defaults', (
assert.equal(config.wproofreader.serviceId, 'svc-123');
assert.equal(config.wproofreader.enableGrammar, true);
assert.equal(config.wproofreader.autocorrect, true);
assert.equal(config.wproofreader.appType, 'wpr_learnosity');
assert.equal(config.wproofreader.appType, 'learnosity_extension');
});

test('self-hosted service options pass through unchanged', () => {
Expand Down Expand Up @@ -50,12 +50,12 @@ test('enableGrammar and autocorrect can be turned off explicitly', () => {
test('appType is set to the fixed partner tag', () => {
const config = buildConfig({ wproofreader: { serviceId: 'svc' } });
assert.equal(config.wproofreader.appType, APP_TYPE);
assert.equal(APP_TYPE, 'wpr_learnosity');
assert.equal(APP_TYPE, 'learnosity_extension');
});

test('appType is not caller-configurable: a supplied value is ignored', () => {
const config = buildConfig({ wproofreader: { serviceId: 'svc', appType: 'custom_partner' } });
assert.equal(config.wproofreader.appType, 'wpr_learnosity');
assert.equal(config.wproofreader.appType, 'learnosity_extension');
});

test('explicit wproofreader.lang overrides defaultLang', (t) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/connector.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ test('attaches via the SDK with the built wproofreader options incl. appType', a
assert.equal(globalThis.__sdkInitCalls.length, 1);
const { options } = globalThis.__sdkInitCalls[0];
assert.equal(options.serviceId, 'svc-123');
assert.equal(options.appType, 'wpr_learnosity');
assert.equal(options.appType, 'learnosity_extension');
assert.equal(options.enableGrammar, true);
assert.equal(options.container, container);
});
Expand Down
Loading