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

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

Comments

Loading...