streamlit

Форк
0
/
st_tabs.spec.js 
70 строк · 2.1 Кб
1
/**
2
 * Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024)
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
describe("st.tabs", () => {
18
  beforeEach(() => {
19
    cy.loadApp("http://localhost:3000/");
20

21
    cy.prepForElementSnapshots();
22
  });
23

24
  it("displays correctly", () => {
25
    cy.get(".stTabs").should("have.length", 3);
26

27
    cy.get(".stTabs").each((el, idx) => {
28
      return cy.wrap(el).matchThemedSnapshots("tabs" + idx);
29
    });
30
  });
31

32
  it("displays correctly in sidebar", () => {
33
    cy.get("[data-testid='stSidebar'] .stTabs [data-baseweb='tab']").should(
34
      "have.length",
35
      2
36
    );
37

38
    cy.get("[data-testid='stSidebar'] .stTabs").first()
39
      .within(() => {
40
        cy.get(".stMarkdown").first().should("have.text", "I am in the sidebar");
41
      });
42

43
    // text from every tab should be here because renderAll property is set to true
44
    cy.get("[data-testid='stSidebar'] .stTabs")
45
      .first()
46
      .within(() => {
47
        cy.get(".stMarkdown").should("have.text", "I am in the sidebarI'm also in the sidebar");
48
      });
49
  });
50

51
  it("changes rendered content on tab selection", () => {
52
    cy.getIndexed(".main .stTabs", 0).within(() => {
53
      let tab_2_button = cy.getIndexed("[data-baseweb='tab']", 1);
54
      tab_2_button.should("exist");
55
      tab_2_button.click();
56

57
      cy.get("[data-baseweb='tab-panel'] .stNumberInput").should(
58
        "have.length",
59
        1
60
      );
61
    });
62
  });
63

64
  it("contains all tabs when overflowing", () => {
65
    cy.get("[data-testid='stExpander'] .stTabs [data-baseweb='tab']").should(
66
      "have.length",
67
      25
68
    );
69
  });
70
});
71

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.