parent
763b19a2f0
commit
23698a432b
|
|
@ -195,11 +195,11 @@ const createHighlight = (text: string, content = false) => {
|
||||||
cy.getByDataCy('highlight-mark').should('have.length', 1);
|
cy.getByDataCy('highlight-mark').should('have.length', 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateHighlight = (text) => {
|
const updateHighlight = (text, color = 'beta') => {
|
||||||
cy.getByDataCy('highlight-beta').click();
|
cy.getByDataCy(`highlight-${color}`).click();
|
||||||
cy.wait('@UpdateHighlight');
|
cy.wait('@UpdateHighlight');
|
||||||
cy.getByDataCy('highlight-mark').should('contain', text);
|
cy.getByDataCy('highlight-mark').should('contain', text);
|
||||||
cy.getByDataCy('highlight-mark').should('have.class', 'highlight--beta');
|
cy.getByDataCy('highlight-mark').should('have.class', `highlight--${color}`);
|
||||||
//
|
//
|
||||||
// we only want to have one of each element and not accidentally create multiple
|
// we only want to have one of each element and not accidentally create multiple
|
||||||
cy.getByDataCy('highlight-popover').should('have.length', 1); // there should only be one popover
|
cy.getByDataCy('highlight-popover').should('have.length', 1); // there should only be one popover
|
||||||
|
|
@ -274,7 +274,8 @@ describe('Highlights', () => {
|
||||||
cy.getByDataCy('highlight-popover').should('be.visible');
|
cy.getByDataCy('highlight-popover').should('be.visible');
|
||||||
cy.getByDataCy('highlight-sidebar').should('be.visible');
|
cy.getByDataCy('highlight-sidebar').should('be.visible');
|
||||||
|
|
||||||
// todo: change the color
|
updateHighlight(highlightedText, 'gamma');
|
||||||
|
cy.getByDataCy('highlight-in-sidebar').should('have.class', 'highlight--gamma');
|
||||||
// todo: write a note
|
// todo: write a note
|
||||||
// todo: click the note icon without first setting a color
|
// todo: click the note icon without first setting a color
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
></div>
|
></div>
|
||||||
<div
|
<div
|
||||||
class="highlight-popover__color highlight-popover__color--blue"
|
class="highlight-popover__color highlight-popover__color--blue"
|
||||||
|
data-cy="highlight-gamma"
|
||||||
@click="$emit('choose-color', 'gamma')"
|
@click="$emit('choose-color', 'gamma')"
|
||||||
></div>
|
></div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -316,7 +316,7 @@ const markClickListenerCurry =
|
||||||
|
|
||||||
// we need to refresh the sidebar
|
// we need to refresh the sidebar
|
||||||
highlightSidebar.open({
|
highlightSidebar.open({
|
||||||
highlight,
|
highlight: newHighlight,
|
||||||
onUpdateText: onUpdateTextCurry(newHighlight),
|
onUpdateText: onUpdateTextCurry(newHighlight),
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue