mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-27 02:48:34 +00:00
Fix editor tests after changing the semantics of is_dirty
This commit is contained in:
parent
052222c91c
commit
5654684d30
3 changed files with 28 additions and 8 deletions
|
@ -568,7 +568,10 @@ impl workspace::Item for ProjectDiagnosticsEditor {
|
|||
}
|
||||
|
||||
fn should_update_tab_on_event(event: &Event) -> bool {
|
||||
matches!(event, Event::Saved | Event::Dirtied | Event::TitleChanged)
|
||||
matches!(
|
||||
event,
|
||||
Event::Saved | Event::DirtyChanged | Event::TitleChanged
|
||||
)
|
||||
}
|
||||
|
||||
fn set_nav_history(&mut self, nav_history: ItemNavHistory, cx: &mut ViewContext<Self>) {
|
||||
|
|
|
@ -5508,7 +5508,7 @@ impl Editor {
|
|||
cx.emit(Event::BufferEdited);
|
||||
}
|
||||
language::Event::Reparsed => cx.emit(Event::Reparsed),
|
||||
language::Event::DirtyChanged => cx.emit(Event::Dirtied),
|
||||
language::Event::DirtyChanged => cx.emit(Event::DirtyChanged),
|
||||
language::Event::Saved => cx.emit(Event::Saved),
|
||||
language::Event::FileHandleChanged => cx.emit(Event::TitleChanged),
|
||||
language::Event::Reloaded => cx.emit(Event::TitleChanged),
|
||||
|
@ -5665,7 +5665,7 @@ pub enum Event {
|
|||
Edited,
|
||||
Reparsed,
|
||||
Blurred,
|
||||
Dirtied,
|
||||
DirtyChanged,
|
||||
Saved,
|
||||
TitleChanged,
|
||||
SelectionsChanged { local: bool },
|
||||
|
@ -6181,7 +6181,10 @@ mod tests {
|
|||
let events = events.clone();
|
||||
|cx| {
|
||||
cx.subscribe(&cx.handle(), move |_, _, event, _| {
|
||||
if matches!(event, Event::Edited | Event::BufferEdited | Event::Dirtied) {
|
||||
if matches!(
|
||||
event,
|
||||
Event::Edited | Event::BufferEdited | Event::DirtyChanged
|
||||
) {
|
||||
events.borrow_mut().push(("editor1", *event));
|
||||
}
|
||||
})
|
||||
|
@ -6193,7 +6196,10 @@ mod tests {
|
|||
let events = events.clone();
|
||||
|cx| {
|
||||
cx.subscribe(&cx.handle(), move |_, _, event, _| {
|
||||
if matches!(event, Event::Edited | Event::BufferEdited | Event::Dirtied) {
|
||||
if matches!(
|
||||
event,
|
||||
Event::Edited | Event::BufferEdited | Event::DirtyChanged
|
||||
) {
|
||||
events.borrow_mut().push(("editor2", *event));
|
||||
}
|
||||
})
|
||||
|
@ -6211,8 +6217,8 @@ mod tests {
|
|||
("editor1", Event::Edited),
|
||||
("editor1", Event::BufferEdited),
|
||||
("editor2", Event::BufferEdited),
|
||||
("editor1", Event::Dirtied),
|
||||
("editor2", Event::Dirtied)
|
||||
("editor1", Event::DirtyChanged),
|
||||
("editor2", Event::DirtyChanged)
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -6235,6 +6241,8 @@ mod tests {
|
|||
("editor1", Event::Edited),
|
||||
("editor1", Event::BufferEdited),
|
||||
("editor2", Event::BufferEdited),
|
||||
("editor1", Event::DirtyChanged),
|
||||
("editor2", Event::DirtyChanged),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -6246,6 +6254,8 @@ mod tests {
|
|||
("editor1", Event::Edited),
|
||||
("editor1", Event::BufferEdited),
|
||||
("editor2", Event::BufferEdited),
|
||||
("editor1", Event::DirtyChanged),
|
||||
("editor2", Event::DirtyChanged),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -6257,6 +6267,8 @@ mod tests {
|
|||
("editor2", Event::Edited),
|
||||
("editor1", Event::BufferEdited),
|
||||
("editor2", Event::BufferEdited),
|
||||
("editor1", Event::DirtyChanged),
|
||||
("editor2", Event::DirtyChanged),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -6268,6 +6280,8 @@ mod tests {
|
|||
("editor2", Event::Edited),
|
||||
("editor1", Event::BufferEdited),
|
||||
("editor2", Event::BufferEdited),
|
||||
("editor1", Event::DirtyChanged),
|
||||
("editor2", Event::DirtyChanged),
|
||||
]
|
||||
);
|
||||
|
||||
|
|
|
@ -440,7 +440,10 @@ impl Item for Editor {
|
|||
}
|
||||
|
||||
fn should_update_tab_on_event(event: &Event) -> bool {
|
||||
matches!(event, Event::Saved | Event::Dirtied | Event::TitleChanged)
|
||||
matches!(
|
||||
event,
|
||||
Event::Saved | Event::DirtyChanged | Event::TitleChanged
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue