Skip to content

Commit

Permalink
The problem is top-level scope isn't making it through
Browse files Browse the repository at this point in the history
Test should now pass once I update ember-repl
  • Loading branch information
NullVoxPopuli committed Feb 19, 2024
1 parent d1491df commit 8596cd7
Show file tree
Hide file tree
Showing 15 changed files with 663 additions and 355 deletions.
2 changes: 1 addition & 1 deletion docs-app/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = async function (defaults) {
staticModifiers: true,
staticComponents: true,
// https://github.com/emberjs/ember.js/issues/20640
// staticEmberSource: true,
staticEmberSource: false,
skipBabel: [
{
package: 'qunit',
Expand Down
14 changes: 13 additions & 1 deletion docs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@
"@embroider/webpack": "3.2.2-unstable.12a42ca",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"@glint/core": "^1.3.0",
"@glint/environment-ember-loose": "^1.3.0",
"@glint/environment-ember-template-imports": "^1.3.0",
"@glint/template": "^1.3.0",
"@nullvoxpopuli/eslint-configs": "^3.2.2",
"@tsconfig/ember": "^3.0.3",
"broccoli-asset-rev": "^3.0.0",
"concurrently": "^8.2.2",
"ember-auto-import": "^2.7.0",
Expand Down Expand Up @@ -77,6 +81,7 @@
"stylelint-config-standard": "^36.0.0",
"stylelint-prettier": "^5.0.0",
"tracked-built-ins": "^3.3.0",
"typescript": "^5.3.3",
"webpack": "^5.89.0"
},
"engines": {
Expand All @@ -90,12 +95,19 @@
},
"dependencies": {
"@universal-ember/kolay-ui": "workspace:^",
"ember-async-data": "^1.0.3",
"ember-cached-decorator-polyfill": "^1.0.2",
"ember-repl": "3.0.0-beta.8",
"ember-route-template": "^1.0.3",
"kolay": "workspace:^"
"kolay": "workspace:^",
"reactiveweb": "^1.2.1"
},
"dependenciesMeta": {
"kolay": {
"injected": true
},
"@universal-ember/kolay-ui": {
"injected": true
}
}
}
8 changes: 8 additions & 0 deletions docs-app/public/docs/components/api-docs.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# `<APIDocs />`

```hbs live
<APIDocs
@module="declarations/browser/re-exports"
@name="APIDocs"
@apiDocs="/docs/kolay.json"
/>
```
10 changes: 7 additions & 3 deletions docs-app/public/docs/plugins/create-manifest.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# `createManifest(...)`

<APIDocs
@module="kolay/plugns/create-manifest/types"
@name="CreateManifestOptions" />
```hbs live
<APIDocs
@module="kolay/plugns/create-manifest/types"
@name="CreateManifestOptions"
@apiDocs="/docs/kolay.json"
/>
```
23 changes: 23 additions & 0 deletions docs-app/tests/components/api-docs-test.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { render } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';

import { APIDocs } from 'kolay';

module('<APIDocs>', function (hooks) {
setupRenderingTest(hooks);

test('it works', async function (assert) {
await render(
<template>
<APIDocs
@module="declarations/browser/re-exports"
@name="APIDocs"
@apiDocs="/docs/kolay.json"
/>
</template>
);

assert.dom().containsText('APIDocs');
});
});
109 changes: 109 additions & 0 deletions docs-app/tests/markdown/rendering-test.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import { setOwner } from '@ember/owner';
import { render, visit, waitUntil } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';

import { service } from 'ember-primitives/helpers';
import { use } from 'ember-resources';
import { addRoutes, Compiled } from 'kolay';

import { setupRouting } from 'ember-primitives/test-support';

module('Markdown | Rendering', function (hooks) {
setupRenderingTest(hooks);

test('it works', async function (assert) {
let doc = `# Hello there`;

class Demo {
@use doc = Compiled(() => doc);
}

let state = new Demo();

setOwner(state, this.owner);

await render(
<template>
{{#if state.doc.component}}
<state.doc.component />
{{/if}}
</template>
);

await waitUntil(() => state.doc.isReady);

assert.dom('h1').containsText('Hello there');
});

test('it renders a live codefence', async function (assert) {
let doc =
`# Hello there\n` +
`\n` +
'```hbs live no-shadow\n' +
'<output>\n' +
`\tgeneral kenobi\n\n` +
'</output>\n' +
'```\n';

class Demo {
@use doc = Compiled(() => doc);
}

let state = new Demo();

setOwner(state, this.owner);

await render(
<template>
{{#if state.doc.component}}
<state.doc.component />
{{/if}}
</template>
);

await waitUntil(() => state.doc.isReady);

assert.dom('h1').containsText('Hello there');
assert.dom('output').containsText('general kenobi');
});

test('it renders a live codefence with one of the global components', async function (assert) {
const Response = <template>
<output>general kenobi</output>
</template>;

let doc =
`# Hello there\n` +
`\n` +
'```hbs live no-shadow\n' +
'\n' +
'<hr>\n' +
'<Response />\n' +
'<hr>\n' +
'```\n';

class Demo {
@use doc = Compiled(() => doc, {
topLevelScope: { Response },
});
}

let state = new Demo();

setOwner(state, this.owner);

await render(
<template>
{{#if state.doc.component}}
<state.doc.component />
{{/if}}
</template>
);

await waitUntil(() => state.doc.isReady);

assert.dom('h1').containsText('Hello there');
assert.dom('output').containsText('general kenobi');
});
});
15 changes: 15 additions & 0 deletions docs-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "@tsconfig/ember/tsconfig.json",
"glint": {
"environment": ["ember-loose", "ember-template-imports"]
},
"compilerOptions": {
"skipLibCheck": true,
"paths": {
"docs-app/tests/*": ["./tests/*"],
"docs-app/*": ["./app/*"],
"*": ["./types/*"]
}
},
"include": ["./app/**/*", "./tests/**/*", "./types/**/*"]
}
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
},
"dependencies": {
"@tsconfig/ember": "^3.0.3",
"@universal-ember/kolay-ui": "workspace:^",
"@zamiell/typedoc-plugin-not-exported": "^0.2.0",
"globby": "^14.0.0",
"package-up": "^5.0.0",
Expand All @@ -88,16 +87,20 @@
"@tsconfig/strictest": "^2.0.3",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"@universal-ember/kolay-ui": "workspace:^",
"concurrently": "^8.2.2",
"ember-modifier": "^4.1.0",
"ember-primitives": "^0.11.3",
"ember-repl": "3.0.0-beta.8",
"ember-resources": "^7.0.0",
"ember-source": "~5.5.0",
"eslint": "^8.56.0",
"pnpm-sync-dependencies-meta-injected": "^0.0.10",
"prettier": "^3.1.1",
"publint": "^0.2.7",
"reactiveweb": "^1.2.1",
"release-plan": "^0.7.0",
"tracked-built-ins": "^3.3.0",
"turbo": "^1.12.3",
"typescript": "^5.3.3",
"vitest": "^1.2.2"
Expand Down Expand Up @@ -147,6 +150,9 @@
]
},
"overrides": {
"@ember/test-waiters": "^3.1.0",
"webpack": "^5.90.3",
"ember-repl": "3.0.0-beta.8",
"@embroider/addon-dev": "4.1.4-unstable.12a42ca",
"@embroider/addon-shim": "1.8.8-unstable.12a42ca",
"@embroider/core": "3.4.4-unstable.12a42ca",
Expand All @@ -171,9 +177,13 @@
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"@glint/template": "^1.3.0",
"@universal-ember/kolay-ui": "workspace:^",
"ember-modifier": "^4.1.0",
"ember-primitives": "^0.11.3",
"ember-repl": "3.0.0-beta.8",
"ember-resources": "^7.0.0",
"ember-source": "~5.5.0"
"ember-source": "~5.5.0",
"reactiveweb": "^1.2.1",
"tracked-built-ins": "^3.3.0"
}
}
Loading

0 comments on commit 8596cd7

Please sign in to comment.