I am running Mail.app on Yosemite with a few Gmail accounts on IMAP. Everything is syncing just fine, with the exception of the Junk folders: every time I use "Erase junk mail...", the emails are immediately deleted from the client, but they still show up in Gmail's spam folder.
This doesn't happen with the other folders (sent mail ecc): whenever I delete an item from one of these folders, the change is synced to the server. They are also configured in the same way in Mail.app:
How can I make sure that emptying the Junk folder in Mail.app deleted all spam from Gmail web as well?