From e1dac618a8b8929f601c7ec8aca3842c5ebf9d03 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 13 Apr 2020 20:37:36 +0900 Subject: Use plugin:prettier/recommended --- .../content/presenters/NavigationPresenter.test.ts | 272 ++++++++++++--------- 1 file changed, 158 insertions(+), 114 deletions(-) (limited to 'test/content/presenters/NavigationPresenter.test.ts') diff --git a/test/content/presenters/NavigationPresenter.test.ts b/test/content/presenters/NavigationPresenter.test.ts index 6aa057b..b362d8d 100644 --- a/test/content/presenters/NavigationPresenter.test.ts +++ b/test/content/presenters/NavigationPresenter.test.ts @@ -1,11 +1,12 @@ -import { NavigationPresenterImpl } from '../../../src/content/presenters/NavigationPresenter'; -import { expect } from 'chai'; +import { NavigationPresenterImpl } from "../../../src/content/presenters/NavigationPresenter"; +import { expect } from "chai"; -describe('NavigationPresenterImpl', () => { +describe("NavigationPresenterImpl", () => { let sut: NavigationPresenterImpl; const testRel = (done, rel, html) => { - const method = rel === 'prev' ? sut.openLinkPrev.bind(sut) : sut.openLinkNext.bind(sut); + const method = + rel === "prev" ? sut.openLinkPrev.bind(sut) : sut.openLinkNext.bind(sut); document.body.innerHTML = html; method(); setTimeout(() => { @@ -13,122 +14,165 @@ describe('NavigationPresenterImpl', () => { done(); }, 0); }; - const testPrev = html => done => testRel(done, 'prev', html); - const testNext = html => done => testRel(done, 'next', html); + const testPrev = (html) => (done) => testRel(done, "prev", html); + const testNext = (html) => (done) => testRel(done, "next", html); before(() => { sut = new NavigationPresenterImpl(); }); - describe('#linkPrev', () => { - it('navigates to elements whose rel attribute is "prev"', testPrev( - '' - )); - - it('navigates to elements whose rel attribute starts with "prev"', testPrev( - '' - )); - - it('navigates to elements whose rel attribute ends with "prev"', testPrev( - '' - )); - - it('navigates to elements whose rel attribute contains "prev"', testPrev( - '' - )); - - it('navigates to elements whose rel attribute is "prev"', testPrev( - '' - )); - - it('navigates to elements whose rel attribute starts with "prev"', testPrev( - 'click me' - )); - - it('navigates to elements whose rel attribute ends with "prev"', testPrev( - 'click me' - )); - - it('navigates to elements whose rel attribute contains "prev"', testPrev( - 'click me' - )); - - it('navigates to elements whose text matches "prev"', testPrev( - 'previewgo to prev' - )); - - it('navigates to elements whose text matches "previous"', testPrev( - 'previouslyprevious page' - )); - - it('navigates to elements whose decoded text matches "<<"', testPrev( - 'click me<<' - )); - - it('navigates to matching elements by clicking', testPrev( - `` - )); - - it('prefers link[rel~=prev] to a[rel~=prev]', testPrev( - '' - )); - - it('prefers a[rel~=prev] to a::text(pattern)', testPrev( - 'go to prev' - )); + describe("#linkPrev", () => { + it( + 'navigates to elements whose rel attribute is "prev"', + testPrev('') + ); + + it( + 'navigates to elements whose rel attribute starts with "prev"', + testPrev('') + ); + + it( + 'navigates to elements whose rel attribute ends with "prev"', + testPrev('') + ); + + it( + 'navigates to elements whose rel attribute contains "prev"', + testPrev('') + ); + + it( + 'navigates to elements whose rel attribute is "prev"', + testPrev('') + ); + + it( + 'navigates to elements whose rel attribute starts with "prev"', + testPrev('click me') + ); + + it( + 'navigates to elements whose rel attribute ends with "prev"', + testPrev('click me') + ); + + it( + 'navigates to elements whose rel attribute contains "prev"', + testPrev('click me') + ); + + it( + 'navigates to elements whose text matches "prev"', + testPrev('previewgo to prev') + ); + + it( + 'navigates to elements whose text matches "previous"', + testPrev( + 'previouslyprevious page' + ) + ); + + it( + 'navigates to elements whose decoded text matches "<<"', + testPrev('click me<<') + ); + + it( + "navigates to matching elements by clicking", + testPrev( + `` + ) + ); + + it( + "prefers link[rel~=prev] to a[rel~=prev]", + testPrev( + '' + ) + ); + + it( + "prefers a[rel~=prev] to a::text(pattern)", + testPrev( + 'go to prev' + ) + ); }); - describe('#linkNext', () => { - it('navigates to elements whose rel attribute is "next"', testNext( - '' - )); - - it('navigates to elements whose rel attribute starts with "next"', testNext( - '' - )); - - it('navigates to elements whose rel attribute ends with "next"', testNext( - '' - )); - - it('navigates to elements whose rel attribute contains "next"', testNext( - '' - )); - - it('navigates to elements whose rel attribute is "next"', testNext( - '' - )); - - it('navigates to elements whose rel attribute starts with "next"', testNext( - 'click me' - )); - - it('navigates to elements whose rel attribute ends with "next"', testNext( - 'click me' - )); - - it('navigates to elements whose rel attribute contains "next"', testNext( - 'click me' - )); - - it('navigates to elements whose text matches "next"', testNext( - 'inextricablego to next' - )); - - it('navigates to elements whose decoded text matches ">>"', testNext( - 'click me>>' - )); - - it('navigates to matching elements by clicking', testNext( - `` - )); - - it('prefers link[rel~=next] to a[rel~=next]', testNext( - '' - )); - - it('prefers a[rel~=next] to a::text(pattern)', testNext( - 'next page' - )); + describe("#linkNext", () => { + it( + 'navigates to elements whose rel attribute is "next"', + testNext('') + ); + + it( + 'navigates to elements whose rel attribute starts with "next"', + testNext('') + ); + + it( + 'navigates to elements whose rel attribute ends with "next"', + testNext('') + ); + + it( + 'navigates to elements whose rel attribute contains "next"', + testNext('') + ); + + it( + 'navigates to elements whose rel attribute is "next"', + testNext('') + ); + + it( + 'navigates to elements whose rel attribute starts with "next"', + testNext('click me') + ); + + it( + 'navigates to elements whose rel attribute ends with "next"', + testNext('click me') + ); + + it( + 'navigates to elements whose rel attribute contains "next"', + testNext('click me') + ); + + it( + 'navigates to elements whose text matches "next"', + testNext( + 'inextricablego to next' + ) + ); + + it( + 'navigates to elements whose decoded text matches ">>"', + testNext('click me>>') + ); + + it( + "navigates to matching elements by clicking", + testNext( + `` + ) + ); + + it( + "prefers link[rel~=next] to a[rel~=next]", + testNext( + '' + ) + ); + + it( + "prefers a[rel~=next] to a::text(pattern)", + testNext( + 'next page' + ) + ); }); }); -- cgit v1.2.3