Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CONTENT] Remove start codes #4913

Merged
merged 16 commits into from
Dec 18, 2023
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
1 change: 0 additions & 1 deletion content/adventures/adventures.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"story_text_6": { "type": "string" },
"example_code_6": { "type": "string" }
},
"required": ["start_code"],
"additionalProperties": false
}
}
Expand Down
504 changes: 11 additions & 493 deletions content/adventures/ar.yaml

Large diffs are not rendered by default.

587 changes: 15 additions & 572 deletions content/adventures/bg.yaml

Large diffs are not rendered by default.

575 changes: 16 additions & 559 deletions content/adventures/bn.yaml

Large diffs are not rendered by default.

567 changes: 10 additions & 557 deletions content/adventures/ca.yaml

Large diffs are not rendered by default.

585 changes: 15 additions & 570 deletions content/adventures/cs.yaml

Large diffs are not rendered by default.

584 changes: 14 additions & 570 deletions content/adventures/cy.yaml

Large diffs are not rendered by default.

590 changes: 14 additions & 576 deletions content/adventures/da.yaml

Large diffs are not rendered by default.

589 changes: 13 additions & 576 deletions content/adventures/de.yaml

Large diffs are not rendered by default.

566 changes: 15 additions & 551 deletions content/adventures/el.yaml

Large diffs are not rendered by default.

581 changes: 10 additions & 571 deletions content/adventures/en.yaml

Large diffs are not rendered by default.

577 changes: 13 additions & 564 deletions content/adventures/eo.yaml

Large diffs are not rendered by default.

471 changes: 20 additions & 451 deletions content/adventures/es.yaml

Large diffs are not rendered by default.

584 changes: 14 additions & 570 deletions content/adventures/et.yaml

Large diffs are not rendered by default.

585 changes: 13 additions & 572 deletions content/adventures/fa.yaml

Large diffs are not rendered by default.

584 changes: 14 additions & 570 deletions content/adventures/fi.yaml

Large diffs are not rendered by default.

377 changes: 14 additions & 363 deletions content/adventures/fr.yaml

Large diffs are not rendered by default.

588 changes: 14 additions & 574 deletions content/adventures/fy.yaml

Large diffs are not rendered by default.

578 changes: 14 additions & 564 deletions content/adventures/he.yaml

Large diffs are not rendered by default.

539 changes: 15 additions & 524 deletions content/adventures/hi.yaml

Large diffs are not rendered by default.

562 changes: 14 additions & 548 deletions content/adventures/hu.yaml

Large diffs are not rendered by default.

565 changes: 13 additions & 552 deletions content/adventures/id.yaml

Large diffs are not rendered by default.

582 changes: 13 additions & 569 deletions content/adventures/it.yaml

Large diffs are not rendered by default.

582 changes: 14 additions & 568 deletions content/adventures/ja.yaml

Large diffs are not rendered by default.

589 changes: 13 additions & 576 deletions content/adventures/kmr.yaml

Large diffs are not rendered by default.

566 changes: 10 additions & 556 deletions content/adventures/ko.yaml

Large diffs are not rendered by default.

581 changes: 10 additions & 571 deletions content/adventures/mi.yaml

Large diffs are not rendered by default.

583 changes: 13 additions & 570 deletions content/adventures/nb_NO.yaml

Large diffs are not rendered by default.

576 changes: 12 additions & 564 deletions content/adventures/nl.yaml

Large diffs are not rendered by default.

584 changes: 14 additions & 570 deletions content/adventures/pa_PK.yaml

Large diffs are not rendered by default.

581 changes: 10 additions & 571 deletions content/adventures/pap.yaml

Large diffs are not rendered by default.

590 changes: 13 additions & 577 deletions content/adventures/pl.yaml

Large diffs are not rendered by default.

583 changes: 14 additions & 569 deletions content/adventures/pt_BR.yaml

Large diffs are not rendered by default.

582 changes: 13 additions & 569 deletions content/adventures/pt_PT.yaml

Large diffs are not rendered by default.

588 changes: 13 additions & 575 deletions content/adventures/ro.yaml

Large diffs are not rendered by default.

579 changes: 14 additions & 565 deletions content/adventures/ru.yaml

Large diffs are not rendered by default.

584 changes: 14 additions & 570 deletions content/adventures/sq.yaml

Large diffs are not rendered by default.

588 changes: 13 additions & 575 deletions content/adventures/sr.yaml

Large diffs are not rendered by default.

560 changes: 11 additions & 549 deletions content/adventures/sv.yaml

Large diffs are not rendered by default.

588 changes: 14 additions & 574 deletions content/adventures/sw.yaml

Large diffs are not rendered by default.

583 changes: 14 additions & 569 deletions content/adventures/te.yaml

Large diffs are not rendered by default.

577 changes: 14 additions & 563 deletions content/adventures/th.yaml

Large diffs are not rendered by default.

584 changes: 14 additions & 570 deletions content/adventures/tl.yaml

Large diffs are not rendered by default.

584 changes: 14 additions & 570 deletions content/adventures/tn.yaml

Large diffs are not rendered by default.

581 changes: 11 additions & 570 deletions content/adventures/tr.yaml

Large diffs are not rendered by default.

581 changes: 13 additions & 568 deletions content/adventures/uk.yaml

Large diffs are not rendered by default.

584 changes: 14 additions & 570 deletions content/adventures/ur.yaml

Large diffs are not rendered by default.

584 changes: 14 additions & 570 deletions content/adventures/vi.yaml

Large diffs are not rendered by default.

402 changes: 20 additions & 382 deletions content/adventures/zh_Hans.yaml

Large diffs are not rendered by default.

583 changes: 14 additions & 569 deletions content/adventures/zh_Hant.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = defineConfig({
login_page: '/login',
recover_page: '/recover',
hedy_page: '/hedy',
hedy_english_keywords: '/hedy?keyword_language=en',
hedy_level2_page: '/hedy/2',
hedy_level5_page: '/hedy/5',
adventure_page: '/hedy/1#print_command',
Expand Down
4 changes: 2 additions & 2 deletions tests/cypress/e2e/hedy_page/editor_box.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Is able to type in the editor box', () => {
it(`Language ${language} should run`, () => {
cy.visit(`${Cypress.env('hedy_page')}?language=${language}#default`);

// click on textaread to get focus, then clear it
// click on text areas to get focus, then clear it
codeMirrorContent().click();
clearViaBackspace();

Expand Down Expand Up @@ -99,4 +99,4 @@ function clearViaBackspace() {

function codeMirrorContent() {
return cy.get('.cm-content');
}
}
11 changes: 8 additions & 3 deletions tests/cypress/e2e/hedy_page/keyword_language.cy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import {goToHedyPage} from "../tools/navigation/nav";
import {goToHedyPageWithEnKeywords} from "../tools/navigation/nav";

describe('when the user changes their language to Arabic', () => {
beforeEach(() => {
goToHedyPage();

goToHedyPageWithEnKeywords();
cy.get('.cm-content').click();
cy.get('#editor').type("print Hallo!'\n");
cy.getBySel('language-dropdown').click();
cy.getBySel('switch-lang-ar').click();

// switch back and forth
cy.getBySel('kwlang-switch-btn').click();
cy.getBySel('kwlang-switch-toggle').click();
});

it('initially has keywords in Arabic', () => {
Expand Down
2 changes: 2 additions & 0 deletions tests/cypress/e2e/hedy_page/run_code_button.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ describe('Is able to run code', () => {
it('Passes', () => {
goToHedyPage();

cy.get('.cm-content').click();
cy.focused().type("print Hallo!'\n");
// Run with correct code
cy.get('#runit').click();
cy.get('#okbox').should('be.visible');
Expand Down
5 changes: 5 additions & 0 deletions tests/cypress/e2e/tools/navigation/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export function goToHedyPage()
return goToPage(Cypress.env('hedy_page'));
}

export function goToHedyPageWithEnKeywords()
{
return goToPage(Cypress.env('hedy_english_keywords'));
}

export function goToAdventurePage()
{
return goToPage(Cypress.env('adventure_page'));
Expand Down
17 changes: 5 additions & 12 deletions tests/test_snippets/test_adventures.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def collect_snippets(path, filtered_language=None):
files = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and f.endswith('.yaml')]
for f in files:
lang = f.split(".")[0]
# we always grab the en snippets to restore broken code
# we always store the English snippets, to use them if we need to restore broken code
if not filtered_language or (filtered_language and (lang == filtered_language or lang == 'en')):
f = os.path.join(path, f)
yaml = YamlFile.for_file(f)
Expand All @@ -46,17 +46,10 @@ def collect_snippets(path, filtered_language=None):
adventure_name = adventure['name']

for adventure_part, text in level.items():
is_markdown = adventure_part != 'start_code'

if is_markdown:
# If we have Markdown, there can be multiple code blocks inside it
codes = [tag.contents[0].contents[0]
for tag in utils.markdown_to_html_tags(text)
if tag.name == 'pre' and tag.contents and tag.contents[0].contents]
else:
# If we don't have Markdown (this happensin the start_code field)
# the entire field is a single code block
codes = [text]
# This block is markdown, and there can be multiple code blocks inside it
codes = [tag.contents[0].contents[0]
for tag in utils.markdown_to_html_tags(text)
if tag.name == 'pre' and tag.contents and tag.contents[0].contents]

if check_stories and adventure_part == 'story_text' and codes != []:
# Can be used to catch languages with example codes in the story_text
Expand Down