2016-10-04 18:09:18 +01:00
|
|
|
// We use the name input_password to match the helper for consistency:
|
2020-04-29 16:44:27 +01:00
|
|
|
const should = require('should');
|
2015-05-13 10:26:49 +01:00
|
|
|
|
2020-04-29 16:44:27 +01:00
|
|
|
// Stuff we are testing
|
|
|
|
const input_password = require('../../../../core/frontend/apps/private-blogging/lib/helpers/input_password');
|
2015-05-13 10:26:49 +01:00
|
|
|
|
|
|
|
describe('{{input_password}} helper', function () {
|
2016-10-04 18:09:18 +01:00
|
|
|
it('has input_password helper', function () {
|
|
|
|
should.exist(input_password);
|
2015-05-13 10:26:49 +01:00
|
|
|
});
|
|
|
|
|
2015-05-23 23:40:42 -06:00
|
|
|
it('returns the correct input when no custom options are specified', function () {
|
2020-04-29 16:44:27 +01:00
|
|
|
const markup = '<input class="private-login-password" type="password" name="password" autofocus="autofocus" />';
|
|
|
|
const rendered = input_password();
|
2015-05-13 10:26:49 +01:00
|
|
|
should.exist(rendered);
|
|
|
|
|
|
|
|
String(rendered).should.equal(markup);
|
|
|
|
});
|
2015-05-23 23:40:42 -06:00
|
|
|
|
|
|
|
it('returns the correct input when a custom class is specified', function () {
|
2020-04-29 16:44:27 +01:00
|
|
|
const markup = '<input class="test-class" type="password" name="password" autofocus="autofocus" />';
|
|
|
|
|
|
|
|
const options = {
|
|
|
|
hash: {
|
|
|
|
class: 'test-class'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const rendered = input_password(options);
|
2015-05-23 23:40:42 -06:00
|
|
|
|
|
|
|
should.exist(rendered);
|
|
|
|
|
|
|
|
String(rendered).should.equal(markup);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns the correct input when a custom placeholder is specified', function () {
|
2020-04-29 16:44:27 +01:00
|
|
|
const markup = '<input class="private-login-password" type="password" name="password" autofocus="autofocus" placeholder="Test" />';
|
|
|
|
|
|
|
|
const options = {
|
|
|
|
hash: {
|
|
|
|
placeholder: 'Test'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const rendered = input_password(options);
|
2015-05-23 23:40:42 -06:00
|
|
|
|
|
|
|
should.exist(rendered);
|
|
|
|
|
|
|
|
String(rendered).should.equal(markup);
|
|
|
|
});
|
2015-05-13 10:26:49 +01:00
|
|
|
});
|