Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

sidebar.js 1.9 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  1. const { getDOM } = require('../helpers/supertest')
  2. describe('sidebar', () => {
  3. jest.setTimeout(3 * 60 * 1000)
  4. let $homePage, $githubPage, $enterprisePage
  5. beforeAll(async (done) => {
  6. [$homePage, $githubPage, $enterprisePage] = await Promise.all([
  7. getDOM('/en'),
  8. getDOM('/en/github'),
  9. getDOM('/en/enterprise/admin')
  10. ])
  11. done()
  12. })
  13. test('highlights active product on Enterprise pages', async () => {
  14. expect($enterprisePage('.sidebar li.sidebar-product').length).toBe(1)
  15. expect($enterprisePage('.sidebar li.sidebar-product > a').text().trim()).toBe('Enterprise Administrators')
  16. })
  17. test('highlights active product on GitHub pages', async () => {
  18. expect($githubPage('.sidebar li.sidebar-product').length).toBe(1)
  19. expect($githubPage('.sidebar li.sidebar-product > a').text().trim()).toBe('GitHub.com')
  20. })
  21. test('includes links to external products like the CLI, Atom, Electron, and CodeQL', async () => {
  22. expect($homePage('.sidebar a[href="https://cli.github.com/manual"]')).toHaveLength(1)
  23. expect($homePage('.sidebar a[href="https://atom.io/docs"]')).toHaveLength(1)
  24. expect($homePage('.sidebar a[href="https://electronjs.org/docs"]')).toHaveLength(1)
  25. expect($homePage('.sidebar a[href="https://codeql.github.com/docs"]')).toHaveLength(1)
  26. })
  27. test('adds an `is-current-page` class to the sidebar link to the current page', async () => {
  28. const url = '/en/github/setting-up-and-managing-your-github-user-account/managing-user-account-settings'
  29. const $ = await getDOM(url)
  30. expect($('.sidebar .is-current-page').length).toBe(1)
  31. expect($('.sidebar .is-current-page a').attr('href')).toContain(url)
  32. })
  33. test('does not display Early Access as a product', async () => {
  34. expect($homePage('.sidebar li.sidebar-product[title*="Early"]').length).toBe(0)
  35. expect($homePage('.sidebar li.sidebar-product[title*="early"]').length).toBe(0)
  36. })
  37. })
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...