mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	compose: Add pills for typing in PM recipients.
@brockwhittaker wrote the original prototype for having
pills in the recipient box when users compose PMs (either
1:1 or huddle).  The prototype was test deloyed on our
main realm for several weeks.
This commit includes all the original CSS and HTML from
the prototype.
After some things changed with the codebase after the initial
test deployment, I made the following changes:
    * In prior commits I refactored out a module called
      `user_pill.js` that implemented some common functions
      against a more streamlined version of `input_pill.js`,
      and this commit largely integrates with that.
    * I made changes in a prior commit to handle Zephyr
      semantics (emails don't get validated) and tested
      this commit with zephyr.
    * I fixed a reload bug by extracting code out to
      `compose_pm_pill.js` and re-ordering some
      calls to `initialize`.
There are still two flaws related to un-pill-ified text in the
input:
    * We could be more aggressive about trying to pill-ify
      emails when you blur or tab away.
    * We only look at the pills when you send the message,
      instead of complaining about the un-pill-ified text.
      (Some folks may consider that a feature, but it's
      probably surprising to others.)
			
			
This commit is contained in:
		@@ -50,7 +50,7 @@ casper.then(function () {
 | 
			
		||||
 | 
			
		||||
casper.then(function () {
 | 
			
		||||
    casper.waitUntilVisible('#private_message_recipient', function () {
 | 
			
		||||
        common.check_form('#send_message_form', {recipient: ''}, "Recipient empty on new PM");
 | 
			
		||||
        common.pm_recipient.expect("");
 | 
			
		||||
        casper.click('body');
 | 
			
		||||
        casper.page.sendEvent('keypress', 'c');
 | 
			
		||||
    });
 | 
			
		||||
@@ -82,7 +82,7 @@ casper.then(function () {
 | 
			
		||||
 | 
			
		||||
casper.then(function () {
 | 
			
		||||
    casper.waitUntilVisible('#private_message_recipient', function () {
 | 
			
		||||
        common.check_form('#send_message_form', {recipient: "cordelia@zulip.com"}, "Recipient populated after PM click");
 | 
			
		||||
        common.pm_recipient.expect("cordelia@zulip.com");
 | 
			
		||||
 | 
			
		||||
        common.keypress(27); //escape
 | 
			
		||||
        casper.page.sendEvent('keypress', 'k');
 | 
			
		||||
@@ -151,13 +151,7 @@ casper.waitUntilVisible('#zhome', function () {
 | 
			
		||||
 | 
			
		||||
casper.then(function () {
 | 
			
		||||
    casper.waitUntilVisible('#compose', function () {
 | 
			
		||||
        // It may be possible to get the textbox contents with CasperJS,
 | 
			
		||||
        // but it's easier to just evaluate jQuery in page context here.
 | 
			
		||||
        var displayed_recipients = casper.evaluate(function () {
 | 
			
		||||
            return $('#private_message_recipient').val();
 | 
			
		||||
        });
 | 
			
		||||
        casper.test.assertEquals(displayed_recipients, recipients.join(', '),
 | 
			
		||||
            'Recipients are displayed correctly in a huddle reply');
 | 
			
		||||
        common.pm_recipient.expect(recipients.join(','));
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user