jest.dontMock('../ProjectManagement.jsx'); describe('ProjectManagement', function() { it('should render a login page when no session exists', function() { var Session = require('../../stores/Session.js'); var React = require('react/addons'); var ProjectManagement = require('../ProjectManagement.jsx'); var TestUtils = React.addons.TestUtils; var Login = require('../Login.jsx'); var ui = TestUtils.renderIntoDocument( <ProjectManagement /> ); var login = TestUtils.findRenderedComponentWithType(ui, Login); expect(login).toBeDefined(); }); it('renders the project list when the session exists and' + ' location indicates projectList: my', function() { var Session = require('../../stores/Session.js'); var Location = require('../../stores/Location.js'); var React = require('react/addons'); var ProjectManagement = require('../ProjectManagement.jsx'); var TestUtils = React.addons.TestUtils; var ProjectList = require('../ProjectList.jsx'); Session.hasSession.mockReturnValueOnce(true); Location.getLocation.mockReturnValue({ projectList: 'my' }); var ui = TestUtils.renderIntoDocument( <ProjectManagement /> ); var list = TestUtils.findRenderedComponentWithType(ui, ProjectList); expect(list).toBeDefined(); }); it('renders the project list when the session exists and' + ' location indicates projectList: all', function() { var Session = require('../../stores/Session.js'); var Location = require('../../stores/Location.js'); var React = require('react/addons'); var ProjectManagement = require('../ProjectManagement.jsx'); var TestUtils = React.addons.TestUtils; var ProjectList = require('../ProjectList.jsx'); Session.hasSession.mockReturnValueOnce(true); Location.getLocation.mockReturnValue({ projectList: 'my' }); var ui = TestUtils.renderIntoDocument( <ProjectManagement /> ); var list = TestUtils.findRenderedComponentWithType(ui, ProjectList); expect(list).toBeDefined(); }); it('renders the project details page when a session exists and' + ' location indicates project', function() { var Session = require('../../stores/Session.js'); var Location = require('../../stores/Location.js'); var React = require('react/addons'); var ProjectManagement = require('../ProjectManagement.jsx'); var TestUtils = React.addons.TestUtils; var ProjectDetails = require('../ProjectDetails.jsx'); Session.hasSession.mockReturnValueOnce(true); Location.getLocation.mockReturnValue({ project: 'example' }); var ui = TestUtils.renderIntoDocument( <ProjectManagement /> ); var details = TestUtils.findRenderedComponentWithType(ui, ProjectDetails); expect(details).toBeDefined(); }); it('renders the create project page when a session exists and' + ' location indicates project', function() { var Session = require('../../stores/Session.js'); var Location = require('../../stores/Location.js'); var React = require('react/addons'); var ProjectManagement = require('../ProjectManagement.jsx'); var TestUtils = React.addons.TestUtils; var CreateProject = require('../CreateProject.jsx'); Session.hasSession.mockReturnValueOnce(true); Location.getLocation.mockReturnValue({ createProject: true }); var ui = TestUtils.renderIntoDocument( <ProjectManagement /> ); var wizard = TestUtils.findRenderedComponentWithType(ui, CreateProject); expect(wizard).toBeDefined(); }); });
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15688 | Doug Scheirer |
Populate -o //guest/perforce_software/helix-web-services/... //guest/doug_scheirer/helix-web-services/.... |
||
//guest/perforce_software/helix-web-services/main/source/helix_web_components/project_management/components/__tests__/ProjectManagement-test.js | |||||
#1 | 15622 | tjuricek |
Move source code to 'source/' subdirectory of branch. build/ will remain where it is. |
||
//guest/perforce_software/helix-web-services/main/helix_web_components/project_management/components/__tests__/ProjectManagement-test.js | |||||
#1 | 13974 | tjuricek |
Moving 'ui/static' to 'helix_web_components' project, and altering some notes. Also, removed obsolete top-level Rake tasks. The "Helix Web Components" project will likely get moved elsewhere in the future. |
||
//guest/perforce_software/helix-web-services/main/ui/static/project_management/components/__tests__/ProjectManagement-test.js | |||||
#2 | 13971 | tjuricek |
Add the ability for the header to display a "subnav" element. This is likely not our final UI, we may need to customize an individual nav-item to function like a breadcrumb. But functionally, it's working, the behavior should be the same. |
||
#1 | 13962 | tjuricek |
Add 'location' store and integrate "Jest" for unit testing. The location will trigger different views of the main ProjectManagement component. The Jest framework allows us to create headless tests of the React component logic. It's a little tricky, and right now has a dependency on node 0.10. |