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
4 changes: 2 additions & 2 deletions docs/userGuide/syntax/extra/quiz.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<question has-input>
<question type="text">
Q1. Name all different types of volatile memory that exists inside a typical household computer system.
<div slot="hint"></div>
<div slot="answer">CPU cache and RAM</div>
</question>

<div>
<panel header=":computer:" minimized>
<question has-input>
<question type="text">
What is the difference between a 32 bit and 64 bit operating system?
</panel>
</div>
6 changes: 0 additions & 6 deletions docs/userGuide/syntax/icons.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ The advantage of font icons over emojis is font icons can be _styled_ to fit you
</span>
</include>

<box type="important">

The syntax for icons has changed, and the earlier {%raw%}`{{ prefix_name }}`{%endraw%} syntax has been deprecated. <br>
Please use the new `:prefix-name:` syntax instead.
</box>

###### Using Font Awesome Icons
1. Decide which icon you want to use from the [list of available icons](https://fontawesome.com/icons?d=gallery&m=free).
1. Construct the MarkBind name for the selected icon by adding the _type prefix_.
Expand Down
2 changes: 1 addition & 1 deletion docs/userGuide/syntax/modals.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This is the same <trigger for="modal:loremipsum">trigger</trigger> as last one.
Name | type | Default | Description
--- | --- | --- | ---
header{{slot_info_trigger}} | `String` | `''` | Header of the Modal component. Supports inline markdown text.
footer <hr style="margin-top:0.2rem; margin-bottom:0" /> <small>modal-footer <br> (deprecated)</small> | {{slot_type_info_trigger}} | empty | Specifying this will override the `ok-text` attribute, and the OK button will not render.
footer | {{slot_type_info_trigger}} | empty | Specifying this will override the `ok-text` attribute, and the OK button will not render.
ok-text | `String` | `''` | Text for the OK button.
effect | `String` | `zoom` | Supports: `zoom`, `fade`.
id | `String` | | Used by [Trigger](#trigger) to activate the Modal by id.<br>**Note: Ensure id for each Modal is unique.**
Expand Down
7 changes: 0 additions & 7 deletions docs/userGuide/syntax/questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,6 @@ keywords | `String` | `''` | Comma delimited string of keywords or phrases to ma
threshold | `Number` | `0.5` | Minimum proportion of keywords that have to be matched in the user's answer for the answer to be marked as correct.
answer{{slot_info_trigger}} | `String` | `''` | The answer or explanation to display when the user clicks the check button.

<box type="important" header="Deprecation notes">

- The old `has-input` attributes translate to `type="text"`, but will be deprecated in a future version.
- `<question>`s without a `type` (or an unrecognised one) will always be marked correct when placed in quizzes.
</box>


#### Quizzes

You can also build a series of questions out of multiple `<question>` components.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<button class="btn btn-secondary">Trigger should not have `algolia-no-index` class</button>
</tooltip>
<p><strong>Question hint and answer should have algolia-no-index class</strong></p>
<question>
<question type="checkbox">
Question should not have `algolia-no-index` class
<template #hint>
<div class="algolia-no-index">Hint should have `algolia-no-index` class</div>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

**Question hint and answer should have algolia-no-index class**

<question>
<question type="checkbox">
Question should not have `algolia-no-index` class
<div slot="hint">Hint should have `algolia-no-index` class</div>
<div slot="answer">Answer should have `algolia-no-index` class</div>
Expand Down
12 changes: 3 additions & 9 deletions packages/core/src/html/NodeProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { isMarkdownFileExt } from '../utils/fsUtil';
import * as logger from '../utils/logger';
import * as linkProcessor from './linkProcessor';
import type VariableProcessor from '../variables/VariableProcessor';
import { warnConflictingAtributesMap, warnDeprecatedAtributesMap } from './warnings';
import { shiftSlotNodeDeeper, transformOldSlotSyntax, renameSlot } from './vueSlotSyntaxProcessor';
import { warnConflictingAtributesMap } from './warnings';
import { shiftSlotNodeDeeper, transformOldSlotSyntax } from './vueSlotSyntaxProcessor';
import { MdAttributeRenderer } from './MdAttributeRenderer';
import { MarkdownProcessor } from './MarkdownProcessor';
import { processScriptAndStyleTag } from './scriptAndStyleTagProcessor';
Expand Down Expand Up @@ -157,11 +157,6 @@ export class NodeProcessor {
cheerio(node).remove();
} else {
this.processedModals[node.attribs.id] = true;

// Transform deprecated slot names; remove when deprecating
renameSlot(node, 'modal-header', 'header');
renameSlot(node, 'modal-footer', 'footer');

this.mdAttributeRenderer.processModalAttributes(node);
}
}
Expand All @@ -177,8 +172,7 @@ export class NodeProcessor {
transformOldSlotSyntax(node);
shiftSlotNodeDeeper(node);

// log warnings for deprecated and conflicting attributes
if (_.has(warnDeprecatedAtributesMap, node.name)) { warnDeprecatedAtributesMap[node.name](node); }
// log warnings for conflicting attributes
if (_.has(warnConflictingAtributesMap, node.name)) { warnConflictingAtributesMap[node.name](node); }

switch (node.name) {
Expand Down
34 changes: 0 additions & 34 deletions packages/core/src/html/warnings.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as logger from '../utils/logger';
import { MbNode } from '../utils/node';
import { getVslotShorthandName } from './vueSlotSyntaxProcessor';

/**
* Check and warns if element has conflicting attributes.
Expand All @@ -24,30 +23,6 @@ function _warnConflictingAttributes(node: MbNode, attribute: string, attrsConfli
});
}

/**
* Check and warns if element has a deprecated slot name
* @param element Root element to check
* @param namePairs Object of slot name pairs with each pair in the form deprecated : correct
*/
function _warnDeprecatedSlotNames(element: MbNode, namePairs: { [name: string]: string }) {
if (!(element.children)) {
return;
}
element.children.forEach((child) => {
const vslotShorthandName = getVslotShorthandName(child);
if (vslotShorthandName) {
Object.entries(namePairs)
.forEach(([deprecatedName, correctName]) => {
if (vslotShorthandName !== deprecatedName) {
return;
}
logger.warn(`${element.name} shorthand slot name '${deprecatedName}' `
+ `is deprecated and may be removed in the future. Please use '${correctName}'`);
});
}
});
}

export const warnConflictingAtributesMap: { [attr: string]: (nd: MbNode) => void } = {
box: (node) => {
_warnConflictingAttributes(node, 'light', ['seamless']);
Expand All @@ -57,12 +32,3 @@ export const warnConflictingAtributesMap: { [attr: string]: (nd: MbNode) => void
_warnConflictingAttributes(node, 'no-icon', ['icon']);
},
};

export const warnDeprecatedAtributesMap: { [attr: string]: (nd: MbNode) => void } = {
modal: (node) => {
_warnDeprecatedSlotNames(node, {
'modal-header': 'header',
'modal-footer': 'footer',
});
},
};
16 changes: 0 additions & 16 deletions packages/core/test/unit/html/NodeProcessor.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,22 +230,6 @@ export const PROCESS_MODAL_OK_TEXT_EXPECTED = `
</modal>
`;

// todo remove these once modal-header modal-footer slot names are deprecated fully.

export const PROCESS_MODAL_SLOTS_RENAMING = `
<modal>
<div slot="modal-header">Should be renamed to header</div>
<div slot="modal-footer">Should be renamed to footer</div>
</modal>
`;

export const PROCESS_MODAL_SLOTS_RENAMING_EXPECTED = `
<modal>
<template #header><div>Should be renamed to header</div></template>
<template #footer><div>Should be renamed to footer</div></template>
</modal>
`;

/*
* Tab, tab-group
*/
Expand Down
4 changes: 0 additions & 4 deletions packages/core/test/unit/html/NodeProcessor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ test('processNode processes modal attributes and inserts into dom as slots corre
processAndVerifyTemplate(testData.PROCESS_MODAL_HEADER,
testData.PROCESS_MODAL_HEADER_EXPECTED);

// todo remove these once 'modal-header' / 'modal-footer' for modal is fully deprecated
processAndVerifyTemplate(testData.PROCESS_MODAL_SLOTS_RENAMING,
testData.PROCESS_MODAL_SLOTS_RENAMING_EXPECTED);

// when the ok-text attr is set, footer shouldn't be disabled and ok-only attr should be added
processAndVerifyTemplate(testData.PROCESS_MODAL_OK_TEXT,
testData.PROCESS_MODAL_OK_TEXT_EXPECTED);
Expand Down
40 changes: 0 additions & 40 deletions packages/vue-components/src/__tests__/Questions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,43 +600,3 @@ describe('Text Questions', () => {
expect(wrapper.element).toMatchSnapshot();
});
});

// TODO deprecate this
describe('Typeless Questions', () => {
test('of answered with answer, header, shown hint renders correctly', async () => {
const wrapper = mount(Question, {
slots: {
default: 'Question content',
header: 'Typeless question header',
answer: 'Typeless question answer',
hint: 'Typeless question hint',
},
provide: DEFAULT_INJECTIONS,
stubs: DEFAULT_STUBS,
});

// click 'check'
await wrapper.find('button.btn-primary').trigger('click');
// click 'hint'
await wrapper.find('button.btn-success').trigger('click');

expect(wrapper.element).toMatchSnapshot();
});

test('of answered with answer, header without hint renders correctly', async () => {
const wrapper = mount(Question, {
slots: {
default: 'Question content',
header: 'Typeless question header',
answer: 'Typeless question answer',
},
provide: DEFAULT_INJECTIONS,
stubs: DEFAULT_STUBS,
});

// click 'check'
await wrapper.find('button.btn-primary').trigger('click');

expect(wrapper.element).toMatchSnapshot();
});
});
Loading