<commit_before>define([
    'jquery',
    'backbone',
    'logger',
    'common/js/spec_helpers/ajax_helpers',
    'common/js/spec_helpers/spec_helpers',
    'teams/js/views/teams_tab',
    'teams/js/spec_helpers/team_spec_helpers'
], function ($, Backbone, Logger, AjaxHelpers, SpecHelpers, TeamsTabView, TeamSpecHelpers) {
    'use strict';

    describe('TeamsTab', function () {
        var expectError = function (teamsTabView, text) {
            expect(teamsTabView.$('.warning').text()).toContain(text);
        };

        var expectFocus = function (element) {
            expect(element.focus).toHaveBeenCalled();
        };

        var createTeamsTabView = function(options) {
            var defaultTopics = {
                    count: 5,
                    num_pages: 1,
                    current_page: 1,
                    start: 0,
                    results: TeamSpecHelpers.createMockTopicData(1, 5)
                },
                teamsTabView = new TeamsTabView(
                    {
                        el: $('.teams-content'),
                        context: TeamSpecHelpers.createMockContext(options)
                    }
                );
            teamsTabView.start();
            return teamsTabView;
        };

        /**
         * Filters out all team events from a list of requests.
         */
        var removeTeamEvents = function (requests) {
            return requests.filter(function (request) {
                if (request.requestBody && request.requestBody.startsWith('event_type=edx.team')) {
                    return false;
                } else {
                    return true;
                }
            });
        };

        beforeEach(function () {
            setFixtures('<div class="teams-content"></div>');
            spyOn($.fn, 'focus');
            spyOn(Logger, 'log');
        });

        afterEach(Backbone.history.stop);

        describe('Navigation', function () {
            it('does not render breadcrumbs for the top level tabs', function() {
                var teamsTabView = createTeamsTabView();
                teamsTabView.router.navigate('#my-teams', {trigger: true});
                expect(teamsTabView.$('.breadcrumbs').length).toBe(0);
                teamsTabView.router.navigate('#browse', {trigger: true});
                expect(teamsTabView.$('.breadcrumbs').length).toBe(0);
            });

            it('does not interfere with anchor links to #content', function () {
                var teamsTabView = createTeamsTabView();
                teamsTabView.router.navigate('#content', {trigger: true});
                expect(teamsTabView.$('.wrapper-msg')).toHaveClass('is-hidden');
            });

            it('displays and focuses an error message when trying to navigate to a nonexistent page', function () {
                var teamsTabView = createTeamsTabView();
                teamsTabView.router.navigate('no_such_page', {trigger: true});
                expectError(teamsTabView, 'The page "no_such_page" could not be found.');
                expectFocus(teamsTabView.$('.warning'));
            });

            it('displays and focuses an error message when trying to navigate to a nonexistent topic', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView();
                teamsTabView.router.navigate('topics/no_such_topic', {trigger: true});
                AjaxHelpers.expectRequest(requests, 'GET', '/api/team/v0/topics/no_such_topic,course/1', null);
                AjaxHelpers.respondWithError(requests, 404);
                expectError(teamsTabView, 'The topic "no_such_topic" could not be found.');
                expectFocus(teamsTabView.$('.warning'));
            });

            it('displays and focuses an error message when trying to navigate to a nonexistent team', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView();
                teamsTabView.router.navigate('teams/' + TeamSpecHelpers.testTopicID + '/no_such_team', {trigger: true});
                AjaxHelpers.expectRequest(requests, 'GET', '/api/team/v0/teams/no_such_team?expand=user', null);
                AjaxHelpers.respondWithError(requests, 404);
                expectError(teamsTabView, 'The team "no_such_team" could not be found.');
                expectFocus(teamsTabView.$('.warning'));
            });

            it('displays and focuses an error message when it receives a 401 AJAX response', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView().render();
                teamsTabView.router.navigate('topics/' + TeamSpecHelpers.testTopicID, {trigger: true});
                AjaxHelpers.respondWithError(requests, 401);
                expectError(teamsTabView, "Your request could not be completed. Reload the page and try again.");
                expectFocus(teamsTabView.$('.warning'));
            });

            it('displays and focuses an error message when it receives a 500 AJAX response', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView().render();
                teamsTabView.router.navigate('topics/' + TeamSpecHelpers.testTopicID, {trigger: true});
                AjaxHelpers.respondWithError(requests, 500);
                expectError(teamsTabView, "Your request could not be completed due to a server problem. Reload the page and try again. If the issue persists, click the Help tab to report the problem.");
                expectFocus(teamsTabView.$('.warning'));

            it('does not navigate to the topics page when syncing its collection if not on the search page', function () {
                var teamsTabView = createTeamsTabView(),
                    collection = TeamSpecHelpers.createMockTeams();
                teamsTabView.createTeamsListView({
                    collection: collection,
                    topic: TeamSpecHelpers.createMockTopic()
                });
                spyOn(Backbone.history, 'navigate');
                collection.trigger('sync');
                expect(Backbone.history.navigate).not.toHaveBeenCalled();
            });
        });

        describe('Analytics Events', function () {
            SpecHelpers.withData({
                'fires a page view event for the topic page': [
                    'topics/' + TeamSpecHelpers.testTopicID,
                    {
                        page_name: 'single-topic',
                        topic_id: TeamSpecHelpers.testTopicID,
                        team_id: null
                    }
                ],
                'fires a page view event for the team page': [
                    'teams/' + TeamSpecHelpers.testTopicID + '/test_team_id',
                    {
                        page_name: 'single-team',
                        topic_id: TeamSpecHelpers.testTopicID,
                        team_id: 'test_team_id'
                    }
                ],
                'fires a page view event for the search team page': [
                    'topics/' + TeamSpecHelpers.testTopicID + '/search',
                    {
                        page_name: 'search-teams',
                        topic_id: TeamSpecHelpers.testTopicID,
                        team_id: null
                    }
                ],
                'fires a page view event for the new team page': [
                    'topics/' + TeamSpecHelpers.testTopicID + '/create-team',
                    {
                        page_name: 'new-team',
                        topic_id: TeamSpecHelpers.testTopicID,
                        team_id: null
                    }
                ],
                'fires a page view event for the edit team page': [
                    'teams/' + TeamSpecHelpers.testTopicID + '/' + 'test_team_id/edit-team',
                    {
                        page_name: 'edit-team',
                        topic_id: TeamSpecHelpers.testTopicID,
                        team_id: 'test_team_id'
                    }
                ]
            }, function (url, expectedEvent) {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView({
                        userInfo: TeamSpecHelpers.createMockUserInfo({ staff: true })
                    });
                teamsTabView.router.navigate(url, {trigger: true});
                if (requests.length) {
                    AjaxHelpers.respondWithJson(requests, {});
                }
                expect(Logger.log).toHaveBeenCalledWith('edx.team.page_viewed', expectedEvent);
            });
        });

        describe('Discussion privileges', function () {
            it('allows privileged access to any team', function () {
                var teamsTabView = createTeamsTabView({
                    userInfo: TeamSpecHelpers.createMockUserInfo({ privileged: true })
                });
                // Note: using `undefined` here to ensure that we
                // don't even look at the team when the user is
                // privileged
                expect(teamsTabView.readOnlyDiscussion(undefined)).toBe(false);
            });

            it('allows access to a team which an unprivileged user is a member of', function () {
                var teamsTabView = createTeamsTabView({
                    userInfo: TeamSpecHelpers.createMockUserInfo({
                        username: TeamSpecHelpers.testUser,
                        privileged: false
                    })
                });
                expect(teamsTabView.readOnlyDiscussion({
                    attributes: {
                        membership: [{
                            user: {
                                username: TeamSpecHelpers.testUser
                            }
                        }]
                    }
                })).toBe(false);
            });

            it('does not allow access if the user is neither privileged nor a team member', function () {
                var teamsTabView = createTeamsTabView({
                    userInfo: TeamSpecHelpers.createMockUserInfo({ privileged: false, staff: true })
                });
                expect(teamsTabView.readOnlyDiscussion({
                    attributes: { membership: [] }
                })).toBe(true);
            });
        });

        describe('Search', function () {
            var verifyTeamsRequest = function(requests, options) {
                AjaxHelpers.expectRequestURL(requests, TeamSpecHelpers.testContext.teamsUrl,
                    _.extend(
                        {
                            topic_id: TeamSpecHelpers.testTopicID,
                            expand: 'user',
                            course_id: TeamSpecHelpers.testCourseID,
                            order_by: '',
                            page: '1',
                            page_size: '10',
                            text_search: ''
                        },
                        options
                    ));
            };

            xit('can search teams', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView();
                teamsTabView.browseTopic(TeamSpecHelpers.testTopicID);
                verifyTeamsRequest(requests, {
                    order_by: 'last_activity_at',
                    text_search: ''
                });
                AjaxHelpers.respondWithJson(requests, {});
                teamsTabView.$('.search-field').val('foo');
                teamsTabView.$('.action-search').click();
                verifyTeamsRequest(requests, {
                    order_by: '',
                    text_search: 'foo'
                });
                AjaxHelpers.respondWithJson(requests, {});
                expect(teamsTabView.$('.page-title').text()).toBe('Team Search');
                expect(teamsTabView.$('.page-description').text()).toBe('Showing results for "foo"');
            });

            xit('can clear a search', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView();
                teamsTabView.browseTopic(TeamSpecHelpers.testTopicID);
                AjaxHelpers.respondWithJson(requests, {});

                // Perform a search
                teamsTabView.$('.search-field').val('foo');
                teamsTabView.$('.action-search').click();
                // Note: this is a bit of a hack -- without it the URL
                // fragment won't be what it would be in the real
                // app. This line sets the fragment without triggering
                // callbacks, allowing teams_tab.js to detect the
                // fragment correctly.
                Backbone.history.navigate('topics/' + TeamSpecHelpers.testTopicID + '/search', {trigger: false});
                AjaxHelpers.respondWithJson(requests, {});

                // Clear the search and submit it again
                teamsTabView.$('.search-field').val('');
                teamsTabView.$('.action-search').click();
                verifyTeamsRequest(requests, {
                    order_by: 'last_activity_at',
                    text_search: ''
                });
                AjaxHelpers.respondWithJson(requests, {});
                expect(teamsTabView.$('.page-title').text()).toBe('Test Topic 1');
                expect(teamsTabView.$('.page-description').text()).toBe('Test description 1');
            });

            xit('clears the search when navigating away and then back', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView();
                teamsTabView.browseTopic(TeamSpecHelpers.testTopicID);
                AjaxHelpers.respondWithJson(requests, {});

                // Perform a search
                teamsTabView.$('.search-field').val('foo');
                teamsTabView.$('.action-search').click();
                AjaxHelpers.respondWithJson(requests, {});

                // Navigate back to the teams list
                teamsTabView.$('.breadcrumbs a').last().click();
                verifyTeamsRequest(removeTeamEvents(requests), {
                    order_by: 'last_activity_at',
                    text_search: ''
                });
                AjaxHelpers.respondWithJson(requests, {});
                expect(teamsTabView.$('.page-title').text()).toBe('Test Topic 1');
                expect(teamsTabView.$('.page-description').text()).toBe('Test description 1');
            });

            xit('does not switch to showing results when the search returns an error', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView();
                teamsTabView.browseTopic(TeamSpecHelpers.testTopicID);
                AjaxHelpers.respondWithJson(requests, {});

                // Perform a search
                teamsTabView.$('.search-field').val('foo');
                teamsTabView.$('.action-search').click();
                AjaxHelpers.respondWithError(requests);
                expect(teamsTabView.$('.page-title').text()).toBe('Test Topic 1');
                expect(teamsTabView.$('.page-description').text()).toBe('Test description 1');
                expect(teamsTabView.$('.search-field').val(), 'foo');
            });
        });
    });
});
<commit_msg>Fix syntax error in teams_tab_spec.js<commit_after>define([
    'jquery',
    'backbone',
    'logger',
    'common/js/spec_helpers/ajax_helpers',
    'common/js/spec_helpers/spec_helpers',
    'teams/js/views/teams_tab',
    'teams/js/spec_helpers/team_spec_helpers'
], function ($, Backbone, Logger, AjaxHelpers, SpecHelpers, TeamsTabView, TeamSpecHelpers) {
    'use strict';

    describe('TeamsTab', function () {
        var expectError = function (teamsTabView, text) {
            expect(teamsTabView.$('.warning').text()).toContain(text);
        };

        var expectFocus = function (element) {
            expect(element.focus).toHaveBeenCalled();
        };

        var createTeamsTabView = function(options) {
            var defaultTopics = {
                    count: 5,
                    num_pages: 1,
                    current_page: 1,
                    start: 0,
                    results: TeamSpecHelpers.createMockTopicData(1, 5)
                },
                teamsTabView = new TeamsTabView(
                    {
                        el: $('.teams-content'),
                        context: TeamSpecHelpers.createMockContext(options)
                    }
                );
            teamsTabView.start();
            return teamsTabView;
        };

        /**
         * Filters out all team events from a list of requests.
         */
        var removeTeamEvents = function (requests) {
            return requests.filter(function (request) {
                if (request.requestBody && request.requestBody.startsWith('event_type=edx.team')) {
                    return false;
                } else {
                    return true;
                }
            });
        };

        beforeEach(function () {
            setFixtures('<div class="teams-content"></div>');
            spyOn($.fn, 'focus');
            spyOn(Logger, 'log');
        });

        afterEach(Backbone.history.stop);

        describe('Navigation', function () {
            it('does not render breadcrumbs for the top level tabs', function() {
                var teamsTabView = createTeamsTabView();
                teamsTabView.router.navigate('#my-teams', {trigger: true});
                expect(teamsTabView.$('.breadcrumbs').length).toBe(0);
                teamsTabView.router.navigate('#browse', {trigger: true});
                expect(teamsTabView.$('.breadcrumbs').length).toBe(0);
            });

            it('does not interfere with anchor links to #content', function () {
                var teamsTabView = createTeamsTabView();
                teamsTabView.router.navigate('#content', {trigger: true});
                expect(teamsTabView.$('.wrapper-msg')).toHaveClass('is-hidden');
            });

            it('displays and focuses an error message when trying to navigate to a nonexistent page', function () {
                var teamsTabView = createTeamsTabView();
                teamsTabView.router.navigate('no_such_page', {trigger: true});
                expectError(teamsTabView, 'The page "no_such_page" could not be found.');
                expectFocus(teamsTabView.$('.warning'));
            });

            it('displays and focuses an error message when trying to navigate to a nonexistent topic', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView();
                teamsTabView.router.navigate('topics/no_such_topic', {trigger: true});
                AjaxHelpers.expectRequest(requests, 'GET', '/api/team/v0/topics/no_such_topic,course/1', null);
                AjaxHelpers.respondWithError(requests, 404);
                expectError(teamsTabView, 'The topic "no_such_topic" could not be found.');
                expectFocus(teamsTabView.$('.warning'));
            });

            it('displays and focuses an error message when trying to navigate to a nonexistent team', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView();
                teamsTabView.router.navigate('teams/' + TeamSpecHelpers.testTopicID + '/no_such_team', {trigger: true});
                AjaxHelpers.expectRequest(requests, 'GET', '/api/team/v0/teams/no_such_team?expand=user', null);
                AjaxHelpers.respondWithError(requests, 404);
                expectError(teamsTabView, 'The team "no_such_team" could not be found.');
                expectFocus(teamsTabView.$('.warning'));
            });

            it('displays and focuses an error message when it receives a 401 AJAX response', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView().render();
                teamsTabView.router.navigate('topics/' + TeamSpecHelpers.testTopicID, {trigger: true});
                AjaxHelpers.respondWithError(requests, 401);
                expectError(teamsTabView, "Your request could not be completed. Reload the page and try again.");
                expectFocus(teamsTabView.$('.warning'));
            });

            it('displays and focuses an error message when it receives a 500 AJAX response', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView().render();
                teamsTabView.router.navigate('topics/' + TeamSpecHelpers.testTopicID, {trigger: true});
                AjaxHelpers.respondWithError(requests, 500);
                expectError(teamsTabView, "Your request could not be completed due to a server problem. Reload the page and try again. If the issue persists, click the Help tab to report the problem.");
                expectFocus(teamsTabView.$('.warning'));
            });

            it('does not navigate to the topics page when syncing its collection if not on the search page', function () {
                var teamsTabView = createTeamsTabView(),
                    collection = TeamSpecHelpers.createMockTeams();
                teamsTabView.createTeamsListView({
                    collection: collection,
                    topic: TeamSpecHelpers.createMockTopic()
                });
                spyOn(Backbone.history, 'navigate');
                collection.trigger('sync');
                expect(Backbone.history.navigate).not.toHaveBeenCalled();
            });
        });

        describe('Analytics Events', function () {
            SpecHelpers.withData({
                'fires a page view event for the topic page': [
                    'topics/' + TeamSpecHelpers.testTopicID,
                    {
                        page_name: 'single-topic',
                        topic_id: TeamSpecHelpers.testTopicID,
                        team_id: null
                    }
                ],
                'fires a page view event for the team page': [
                    'teams/' + TeamSpecHelpers.testTopicID + '/test_team_id',
                    {
                        page_name: 'single-team',
                        topic_id: TeamSpecHelpers.testTopicID,
                        team_id: 'test_team_id'
                    }
                ],
                'fires a page view event for the search team page': [
                    'topics/' + TeamSpecHelpers.testTopicID + '/search',
                    {
                        page_name: 'search-teams',
                        topic_id: TeamSpecHelpers.testTopicID,
                        team_id: null
                    }
                ],
                'fires a page view event for the new team page': [
                    'topics/' + TeamSpecHelpers.testTopicID + '/create-team',
                    {
                        page_name: 'new-team',
                        topic_id: TeamSpecHelpers.testTopicID,
                        team_id: null
                    }
                ],
                'fires a page view event for the edit team page': [
                    'teams/' + TeamSpecHelpers.testTopicID + '/' + 'test_team_id/edit-team',
                    {
                        page_name: 'edit-team',
                        topic_id: TeamSpecHelpers.testTopicID,
                        team_id: 'test_team_id'
                    }
                ]
            }, function (url, expectedEvent) {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView({
                        userInfo: TeamSpecHelpers.createMockUserInfo({ staff: true })
                    });
                teamsTabView.router.navigate(url, {trigger: true});
                if (requests.length) {
                    AjaxHelpers.respondWithJson(requests, {});
                }
                expect(Logger.log).toHaveBeenCalledWith('edx.team.page_viewed', expectedEvent);
            });
        });

        describe('Discussion privileges', function () {
            it('allows privileged access to any team', function () {
                var teamsTabView = createTeamsTabView({
                    userInfo: TeamSpecHelpers.createMockUserInfo({ privileged: true })
                });
                // Note: using `undefined` here to ensure that we
                // don't even look at the team when the user is
                // privileged
                expect(teamsTabView.readOnlyDiscussion(undefined)).toBe(false);
            });

            it('allows access to a team which an unprivileged user is a member of', function () {
                var teamsTabView = createTeamsTabView({
                    userInfo: TeamSpecHelpers.createMockUserInfo({
                        username: TeamSpecHelpers.testUser,
                        privileged: false
                    })
                });
                expect(teamsTabView.readOnlyDiscussion({
                    attributes: {
                        membership: [{
                            user: {
                                username: TeamSpecHelpers.testUser
                            }
                        }]
                    }
                })).toBe(false);
            });

            it('does not allow access if the user is neither privileged nor a team member', function () {
                var teamsTabView = createTeamsTabView({
                    userInfo: TeamSpecHelpers.createMockUserInfo({ privileged: false, staff: true })
                });
                expect(teamsTabView.readOnlyDiscussion({
                    attributes: { membership: [] }
                })).toBe(true);
            });
        });

        describe('Search', function () {
            var verifyTeamsRequest = function(requests, options) {
                AjaxHelpers.expectRequestURL(requests, TeamSpecHelpers.testContext.teamsUrl,
                    _.extend(
                        {
                            topic_id: TeamSpecHelpers.testTopicID,
                            expand: 'user',
                            course_id: TeamSpecHelpers.testCourseID,
                            order_by: '',
                            page: '1',
                            page_size: '10',
                            text_search: ''
                        },
                        options
                    ));
            };

            xit('can search teams', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView();
                teamsTabView.browseTopic(TeamSpecHelpers.testTopicID);
                verifyTeamsRequest(requests, {
                    order_by: 'last_activity_at',
                    text_search: ''
                });
                AjaxHelpers.respondWithJson(requests, {});
                teamsTabView.$('.search-field').val('foo');
                teamsTabView.$('.action-search').click();
                verifyTeamsRequest(requests, {
                    order_by: '',
                    text_search: 'foo'
                });
                AjaxHelpers.respondWithJson(requests, {});
                expect(teamsTabView.$('.page-title').text()).toBe('Team Search');
                expect(teamsTabView.$('.page-description').text()).toBe('Showing results for "foo"');
            });

            xit('can clear a search', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView();
                teamsTabView.browseTopic(TeamSpecHelpers.testTopicID);
                AjaxHelpers.respondWithJson(requests, {});

                // Perform a search
                teamsTabView.$('.search-field').val('foo');
                teamsTabView.$('.action-search').click();
                // Note: this is a bit of a hack -- without it the URL
                // fragment won't be what it would be in the real
                // app. This line sets the fragment without triggering
                // callbacks, allowing teams_tab.js to detect the
                // fragment correctly.
                Backbone.history.navigate('topics/' + TeamSpecHelpers.testTopicID + '/search', {trigger: false});
                AjaxHelpers.respondWithJson(requests, {});

                // Clear the search and submit it again
                teamsTabView.$('.search-field').val('');
                teamsTabView.$('.action-search').click();
                verifyTeamsRequest(requests, {
                    order_by: 'last_activity_at',
                    text_search: ''
                });
                AjaxHelpers.respondWithJson(requests, {});
                expect(teamsTabView.$('.page-title').text()).toBe('Test Topic 1');
                expect(teamsTabView.$('.page-description').text()).toBe('Test description 1');
            });

            xit('clears the search when navigating away and then back', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView();
                teamsTabView.browseTopic(TeamSpecHelpers.testTopicID);
                AjaxHelpers.respondWithJson(requests, {});

                // Perform a search
                teamsTabView.$('.search-field').val('foo');
                teamsTabView.$('.action-search').click();
                AjaxHelpers.respondWithJson(requests, {});

                // Navigate back to the teams list
                teamsTabView.$('.breadcrumbs a').last().click();
                verifyTeamsRequest(removeTeamEvents(requests), {
                    order_by: 'last_activity_at',
                    text_search: ''
                });
                AjaxHelpers.respondWithJson(requests, {});
                expect(teamsTabView.$('.page-title').text()).toBe('Test Topic 1');
                expect(teamsTabView.$('.page-description').text()).toBe('Test description 1');
            });

            xit('does not switch to showing results when the search returns an error', function () {
                var requests = AjaxHelpers.requests(this),
                    teamsTabView = createTeamsTabView();
                teamsTabView.browseTopic(TeamSpecHelpers.testTopicID);
                AjaxHelpers.respondWithJson(requests, {});

                // Perform a search
                teamsTabView.$('.search-field').val('foo');
                teamsTabView.$('.action-search').click();
                AjaxHelpers.respondWithError(requests);
                expect(teamsTabView.$('.page-title').text()).toBe('Test Topic 1');
                expect(teamsTabView.$('.page-description').text()).toBe('Test description 1');
                expect(teamsTabView.$('.search-field').val(), 'foo');
            });
        });
    });
});

{'fraction_non_alphanumeric': 0.10874824907678594, 'fraction_numerical': 0.0024194575321533174, 'mean_word_length': 1.5229298851497872, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3633110', 'n_tokens_mistral': 7830, 'n_tokens_neox': 7407, 'n_words': 1566}