From e5332068787503d8d901ae7f848bcdad8fef8f25 Mon Sep 17 00:00:00 2001 From: Tim Berners-Lee Date: Thu, 29 Aug 2024 13:48:40 -0400 Subject: [PATCH 1/5] remove licenseOptions code and call --- src/outline/licenseOptions.js | 105 ---------------------------------- src/outline/manager.js | 9 --- 2 files changed, 114 deletions(-) delete mode 100644 src/outline/licenseOptions.js diff --git a/src/outline/licenseOptions.js b/src/outline/licenseOptions.js deleted file mode 100644 index 6b6e63b..0000000 --- a/src/outline/licenseOptions.js +++ /dev/null @@ -1,105 +0,0 @@ -// This was a student project to -// allow the user to chose favoite CC license terms and have them highlighted - -// tabulator.options becaome UI.licenseOptions -// Possible future alternative directoons: Store license preferences in a solid preferences file -import { store } from 'solid-logic' - -export const licenseURI = [ - 'http://creativecommons.org/licenses/by-nc-nd/3.0/', - 'http://creativecommons.org/licenses/by-nc-sa/3.0/', - 'http://creativecommons.org/licenses/by-nc/3.0/', - 'http://creativecommons.org/licenses/by-nd/3.0/', - 'http://creativecommons.org/licenses/by-sa/3.0/', - 'http://creativecommons.org/licenses/by/3.0/' -] - -const names = ['BY-NC-ND', 'BY-NC-SA', 'BY-NC', 'BY-ND', 'BY-SA', 'BY'] - -export function licenseOptions () { - this.options = {} - this.references = [] - this.checkedLicenses = [] - - this.openCheckBoxWindow = function () { - this.this.display = window.open( - ' ', - 'NewWin', - 'menubar=0,location=no,status=no,directories=no,toolbar=no,scrollbars=yes,height=200,width=200' - ) - } - let message = "
" - const lics = this.checkedLicenses - for (let kk = 0; kk < lics.length; kk++) { - message += - "CC: ' + - names[kk] + - '
' - } - - message += - "
[Select All] " // @@ FIXME - message += " [Deselect All]" // @@ FIXME - message += '
' - - this.display.document.write(message) - - this.display.document.close() - - let i - for (i = 0; i < 6; i++) { - this.references[i] = this.this.display.document.checkboxes.elements[i] - } - - this.selectAll = function () { - let i - for (i = 0; i < 6; i++) { - this.display.document.checkboxes.elements[i].checked = true - this.references[i].checked = true - this.checkedLicenses[i] = true - } - } - - this.deselectAll = function () { - let i - for (i = 0; i < 6; i++) { - this.display.document.checkboxes.elements[i].checked = false - this.references[i].checked = false - this.checkedLicenses[i] = false - } - } - - this.submit = function () { - // alert('this.submit: checked=' + this.references[0].checked) - for (let i = 0; i < 6; i++) { - this.checkedLicenses[i] = !!this.references[i].checked - } - } - - this.checkLicense = function checkLicense (statement) { - const licenses = store.each( - statement.why, - store.sym('http://creativecommons.org/ns#license'), - null, - statement.why - ) - // UI.log.info('licenses:' + statement.why + ': ' + licenses) - for (let i = 0; i < licenses.length; i++) { - for (let j = 0; j < this.checkedLicenses.length; j++) { - if (this.checkedLicenses[j] && licenses[i].uri === licenseURI[j]) { - return true - // theClass += ' licOkay' // icon_expand - // break - } - } - } - return false - } - return this -} - -// ends diff --git a/src/outline/manager.js b/src/outline/manager.js index 12e780b..50541ab 100644 --- a/src/outline/manager.js +++ b/src/outline/manager.js @@ -7,8 +7,6 @@ import * as $rdf from 'rdflib' import * as UI from 'solid-ui' import { authn, authSession, store } from 'solid-logic' import { propertyViews } from './propertyViews' -import { licenseOptions } from './licenseOptions' - import { outlineIcons } from './outlineIcons.js' // @@ chec import { UserInput } from './userInput.js' import * as queryByExample from './queryByExample.js' @@ -179,13 +177,6 @@ export default function (context) { td.setAttribute('notSelectable', 'false') let theClass = 'obj' - // check the IPR on the data. Ok if there is any checked license which is one the document has. - if (statement && statement.why) { - if (licenseOptions && licenseOptions.checklicense && licenseOptions.checklicense()) { - theClass += ' licOkay' // flag as light green etc .licOkay {background-color: #dfd} - } - } - // set about and put 'expand' icon if ( obj.termType === 'NamedNode' || From bf639dd121b6f088c8a05a24187e152f2adbadb3 Mon Sep 17 00:00:00 2001 From: Tim Berners-Lee Date: Sat, 31 Aug 2024 09:33:53 -0400 Subject: [PATCH 2/5] fix ts errors in tests --- tsconfig.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tsconfig.json b/tsconfig.json index afd02da..2094252 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -53,6 +53,9 @@ "./typings" ] /* List of folders to include type definitions from. */, // "types": [], /* Type declaration files to be included in compilation. */ + + "types": ["node", "jsdom", "@testing-library/jest-dom"], /* https://medium.com/heybooster/debugging-typescript-jest-dom-matchers-in-vue-js-6962dab4d4cc */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ From 689656991eae28cb5f08d716012f98099cef6b78 Mon Sep 17 00:00:00 2001 From: Tim Berners-Lee Date: Tue, 3 Sep 2024 15:38:44 -0400 Subject: [PATCH 3/5] remove tests from exclude in tsconfig --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 2094252..6fa7534 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -71,5 +71,5 @@ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ }, "include": ["src/**/*"], - "exclude": ["node_modules", "**/*.test.ts"] + "exclude": ["node_modules"] // was , "**/*.test.ts" } From 5b5cbe734dbbea965a5b9b94195e97fe145eec9d Mon Sep 17 00:00:00 2001 From: Tim Berners-Lee Date: Tue, 3 Sep 2024 16:05:44 -0400 Subject: [PATCH 4/5] test also mbox anchor text --- src/outline/propertyViews.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/outline/propertyViews.test.ts b/src/outline/propertyViews.test.ts index 37766eb..df02a6e 100644 --- a/src/outline/propertyViews.test.ts +++ b/src/outline/propertyViews.test.ts @@ -30,6 +30,7 @@ describe('property views', () => { const view = views.defaults[property] const result = view(sym('mailto:alice@mail.example')) expect(result).toBeInstanceOf(HTMLAnchorElement) - expect(result).toHaveAttribute('href', 'mailto:alice@mail.example') + expect(result).toHaveAttribute('href', 'mailto:alice@mail.example'); + expect(result).toHaveTextContent('alice@mail.example'); }) }) From fcdc420285b0d407e8021556f7e375d5b87ce36b Mon Sep 17 00:00:00 2001 From: Tim Berners-Lee Date: Tue, 3 Sep 2024 16:07:02 -0400 Subject: [PATCH 5/5] types for jest-dom --- package.json | 2 +- tsconfig.json | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 245a784..99410b9 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "homepage": "https://github.com/solidos/solid-panes", "dependencies": { "@solid/better-simple-slideshow": "^0.1.0", + "@types/jest": "^29.5.12", "activitystreams-pane": "^0.6.13", "chat-pane": "^2.4.26", "contacts-pane": "^2.6.12", @@ -68,7 +69,6 @@ "@babel/preset-typescript": "^7.24.1", "@testing-library/dom": "^9.3.4", "@testing-library/jest-dom": "^6.4.2", - "@types/jest": "^29.5.12", "@types/webpack-env": "^1.18.4", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", diff --git a/tsconfig.json b/tsconfig.json index 6fa7534..5d229f1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,4 +1,6 @@ { + // See https://stackoverflow.com/questions/54139158/cannot-find-name-describe-do-you-need-to-install-type-definitions-for-a-test + "compilerOptions": { /* Basic Options */ "target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */, @@ -50,11 +52,12 @@ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ "typeRoots": [ "node_modules/@types", + "node_modules/@testing-library", "./typings" ] /* List of folders to include type definitions from. */, // "types": [], /* Type declaration files to be included in compilation. */ - "types": ["node", "jsdom", "@testing-library/jest-dom"], /* https://medium.com/heybooster/debugging-typescript-jest-dom-matchers-in-vue-js-6962dab4d4cc */ + "types": ["node", "jsdom", "jest", "jest-dom"], /* https://medium.com/heybooster/debugging-typescript-jest-dom-matchers-in-vue-js-6962dab4d4cc */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */