Browse Source

test_testEmojiPickerActionListener

remotes/origin/client-handler
Valentin Spiroski 11 months ago
parent
commit
fbd24f4ee9
  1. 2
      src/main/java/EmojiPicker.java
  2. 19
      src/test/java/TestEmojiPicker.java

2
src/main/java/EmojiPicker.java

@ -36,7 +36,7 @@ public class EmojiPicker extends JPanel {
/**
* ActionListener for handling emoji button clicks.
*/
private class EmojiActionListener implements ActionListener {
class EmojiActionListener implements ActionListener {
private String emoji; // Selected emoji

19
src/test/java/TestEmojiPicker.java

@ -50,5 +50,24 @@ public class TestEmojiPicker {
}
}
@Test
public void testEmojiPickerActionListener() {
JTextField textField = new JTextField();
EmojiPicker emojiPicker = new EmojiPicker(textField);
Component[] components = emojiPicker.getComponents();
for (Component component : components) {
assertTrue(component instanceof JButton);
JButton button = (JButton) component;
assertNotNull(button.getActionListeners());
assertEquals(1, button.getActionListeners().length);
assertTrue(button.getActionListeners()[0] instanceof EmojiPicker.EmojiActionListener);
}
}
}
Loading…
Cancel
Save