register.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import assert from 'assert';
  2. import React from 'react'; // jshint ignore:line
  3. import ReactDOM from 'react-dom'; // jshint ignore:line
  4. import misago from 'misago/index';
  5. import { RegisterForm, RegisterComplete } from 'misago/components/register'; // jshint ignore:line
  6. import modal from 'misago/services/modal';
  7. import snackbar from 'misago/services/snackbar';
  8. let snackbarStore = null;
  9. describe("Register Complete", function() {
  10. afterEach(function() {
  11. window.emptyTestContainers();
  12. });
  13. it("renders user-activated message", function() {
  14. /* jshint ignore:start */
  15. ReactDOM.render(
  16. <RegisterComplete activation="user"
  17. username="Bob"
  18. email="bob@boberson.com" />,
  19. document.getElementById('test-mount')
  20. );
  21. /* jshint ignore:end */
  22. let element = $('#test-mount .modal-message');
  23. assert.ok(element.length, "component renders");
  24. assert.equal(element.find('p').first().text().trim(),
  25. "Bob, your account has been created but you need to activate it before you will be able to sign in.",
  26. "component renders valid message");
  27. assert.equal(element.find('p').last().text().trim(),
  28. "We have sent an e-mail to bob@boberson.com with link that you have to click to activate your account.",
  29. "component renders valid activation instruction");
  30. });
  31. it("renders admin-activated message", function() {
  32. /* jshint ignore:start */
  33. ReactDOM.render(
  34. <RegisterComplete activation="admin"
  35. username="Bob"
  36. email="bob@boberson.com" />,
  37. document.getElementById('test-mount')
  38. );
  39. /* jshint ignore:end */
  40. let element = $('#test-mount .modal-message');
  41. assert.ok(element.length, "component renders");
  42. assert.equal(element.find('p').first().text().trim(),
  43. "Bob, your account has been created but board administrator will have to activate it before you will be able to sign in.",
  44. "component renders valid message");
  45. assert.equal(element.find('p').last().text().trim(),
  46. "We will send an e-mail to bob@boberson.com when this takes place.",
  47. "component renders valid activation instruction");
  48. });
  49. });