SQLite does not enforce foreign key constraints by default (mostly to be backward compatible).
To enable it, you have to execute
PRAGMA foreign_keys = 1
after you connected to the database.
See the manual about PRAGMA foreign_keys
for more details.