A jihadist group with ties to the Islamic State has claimed responsibility for a mortar attack on a Hamas base in the Gaza Strip.