feat: test custom output for js objects (#45077)
This commit is contained in:
@ -11,7 +11,10 @@ const locations = {
|
|||||||
'say-hello-to-html-elements',
|
'say-hello-to-html-elements',
|
||||||
jQuery:
|
jQuery:
|
||||||
'/learn/front-end-development-libraries/jquery/' +
|
'/learn/front-end-development-libraries/jquery/' +
|
||||||
'target-html-elements-with-selectors-using-jquery'
|
'target-html-elements-with-selectors-using-jquery',
|
||||||
|
js:
|
||||||
|
'/learn/javascript-algorithms-and-data-structures/basic-javascript/' +
|
||||||
|
'comment-your-javascript-code'
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultOutput = `
|
const defaultOutput = `
|
||||||
@ -84,3 +87,42 @@ describe('jQuery challenge', function () {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Custom output for JavaScript objects', function () {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.visit(locations.js);
|
||||||
|
cy.get(selectors.editor, {
|
||||||
|
timeout: 15000
|
||||||
|
})
|
||||||
|
.first()
|
||||||
|
.click()
|
||||||
|
.focused()
|
||||||
|
.type('{ctrl}a')
|
||||||
|
.clear();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Set object', () => {
|
||||||
|
cy.get(selectors.editor)
|
||||||
|
.first()
|
||||||
|
.click()
|
||||||
|
.focused()
|
||||||
|
.type(
|
||||||
|
'const set = new Set();{enter}set.add(1);{enter}set.add("set");{enter}set.add(10);{enter}console.log(set);'
|
||||||
|
);
|
||||||
|
cy.get(selectors.defaultOutput).should('contain', 'Set(3) {1, set, 10}');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Map object', () => {
|
||||||
|
cy.get(selectors.editor)
|
||||||
|
.first()
|
||||||
|
.click()
|
||||||
|
.focused()
|
||||||
|
.type(
|
||||||
|
'const map = new Map();{enter}map.set("first", 1);{enter}map.set("second", 2);{enter}map.set("other", "map");{enter}console.log(map);'
|
||||||
|
);
|
||||||
|
cy.get(selectors.defaultOutput).should(
|
||||||
|
'contain',
|
||||||
|
'Map(3) {first => 1, second => 2, other => map})'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Reference in New Issue
Block a user